How reliable is the FileSystemWatcher in .netFramwork 4?

Posted on

Problem :

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 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

Solution :

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.

Leave a Reply

Your email address will not be published. Required fields are marked *