Featured Post

Device Command Shell – DCS – A Simple but very useful Powe

Found a neat little PowerToy for smart device development, a Shell enhancement to the Visual Studio 2005 – Device Command Shell (DCS). DCS neatly tucks itself within the command window, and you can execute various shell commands against your target device. This tiny tool gives you the flexibility to...

Read More

The Infamous “Multiple Events” Problem in FileSystemWatcher Class

Posted by Logu Krishnan | Posted in Uncategorized | Posted on 02-11-2005

0

Whoever, tries the FileSystemWatcher Class for first time, immedietly starts complaining about multiple event notifications and after a brief moment complains, that .NET is buggy and concludes that as a bug. Had heard this many times, and again recently came up with this issue…

Actually, the real root cause of this problem is the File System, NTFS. for e.g.: when a file modification operation occurs NTFS gives out 2 notifications,

Notification 1 : for Data Stream
Notification 2 : for Metadata

Hence 2 Notifications… Poor FSW Class, just handles this and does it’s job properly. Only possible way is to ignore the 2nd Notification.

else, we can use WMI and specify the polling interval, which should read something like the below,
“SELECT * FROM __InstanceModificationEvent WITHIN 10 …..”

Absolutely, nothing wrong in .NET…

No related posts.

Write a comment