|
-
August 11th, 2011, 12:16 PM
#5
Re: filesystem watcher duplicates events
 Originally Posted by BioPhysEngr
Hrm... I am not sure about this. It oughtn't to trigger multiple events for any single file change, so the amount of time it takes to process doesn't seem like it should matter. The articles I referenced seemed to suggest that the duplicate events for the same file where due to FileSystemWatcher monitoring underlying filesystem events which were (for whatever reason) duplicated.
No?
I not saying this is definitely the problem, but if the watcher throws an event and the OnChanged event doesn't immediately return, it's possible that another event will occur while the OnChange event is blocked.
One way to verify my suggestion is to write some debug output strings inside the OnChange handler (and temporarily remove the blocking process.WaitForExit() call).
Another possibility is the OnChange handler might be used for multiple change events. If I recall correctly, there is a filter that specifies what types of events that are thrown (i.e. new, changed, renamed, etc. events). If these are wired up to the same handler, you can get what appear as duplicates if the same handler is used.
Check out the ChangeType property for the FileSystemEventArgs to help narrow down the cause of the change.
Last edited by Arjay; August 11th, 2011 at 12:21 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|