Featured Post

Life… Before & after marriage… A Honest loopback, after a

I have a habit when it comes to reading books, I usually take a longer time to finish a book.. Sometimes 6 months! Also I’m not a avid reader who gets the next so-called bestsellers and finish it off right away, I never found any reason for most of the books to be best-sellers. To me a book is...

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…

Write a comment