Has anyone used the FileSystemWatcher in framework 4 and have you encountered any problems?
i am using it in a windows service and i cant afford for it to fail.
I have heard from a friend that it is not very reliable but I have been testing for a few hours now and i havent had any problems but i am still doubting using it.....
i would appreciate any advice on this matter, i dont want to deliver the app to the the client and then realise that this thing is going to crash....
Thanks
Thanks for the advice guys
i think for my purposes it should be ok. it will be checking a folder on the local drive of the server and all its checking for is if a file have been modified so i think it should be fine
FileSystemWatcher is "known to be unreliable". In simple words, it doesn't work well. If the data size of the collected watcher events exceeds the size of the buffer created by FileSystemWatcher, the events that overflow are lost, and reliable exceptions are not raised.
Nope, filesystemwatchers run on their own thread.
Use FileSystemWatcher to watch for changes in a specified directory. You can watch for changes in files and subdirectories of the specified directory. You can create a component to watch files on a local computer, a network drive, or a remote computer.
The FileSystemWatcher lets you detect several types of changes in a directory or file, like the 'LastWrite' date and time, changes in the size of files or directories etc. It also helps you detect if a file or directory is deleted, renamed or created.
FileSystemWatcher
relies on underlying file system support, so any reliability issues with the file system will be visible as reliability issues with FileSystemWatcher
. For example, if you are watching a network directory, then the network server's reliability will affect FileSystemWatcher
's reliability. For example, the server may crash and be restarted. You will not be notified of changes that take place while network connectivity is lost. Or the server may simply have a bug that prevents FileSystemWatcher
from working reliably.
Another point is that FileSystemWatcher
only watches for changes to metadata. Not all file changes result in changes to metadata.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With