Posts

Es werden Posts vom Dezember, 2009 angezeigt.

Pulling the rug from under Uncle FileSystemWatcher

The FileSystemWatcher class is a nice treat if you need to trace file system modifications (e.g. wait for a file to be created or deleted in a specific path). The full MSDN documentation gives specs and usage examples. You will see it's easy to use and still powerful, allowing a variety of scenarios to be monitored. There is one point, though, that I had to painfully find out by messing it up before realizing it was an issue at all. Imagine the following scenario: - You are monitoring a network path (UNC or mapped drive), or let's rather say your FileSystemWatcher is. - The network path becomes unavailable (deleted or unavailable due to network trouble...) What would you expect? Well, forget about that, because what actually happens is the following: Nothing. Period.Even if the path resurfaces, your FileSystemWatcher is out of its game. That renders it rather useless, because who has a use for a deaf event listener? Anyway, that's what recently happened within a windows s