I am using a FileSystemWatcher on a directory and added its event handlers, set its EnableRaisingEvents
to true
and IncludeSubdirectories
to false
and added NotifyFilters.
While running the application if I create new folders in the specified directory sometime I get
FileNotFoundException : "An error occurred while reading a directory".
The StackTrace is:
System.IO.FileSystemWatcher.StartRaisingEvents() System.IO.FileSystemWatcher.set_EnableRaisingEvents(Boolean value)
What can be root cause of the problem?
Add: Can anybody throw some light on what this StartRaisingEvents()
dos?