[Mono-list] FileSystemWatcher difference between mono and .Net

Andres G. Aragoneses knocte at gmail.com
Fri Nov 9 14:04:48 UTC 2012


Yeah, in general: don't assume that a Mono bug in Windows is a bug in 
every platform. Windows support in Mono is worse than other platforms, 
because in Windows there is already .NET anyway which works for most people.

On 09/11/12 03:49, Daniel Lo Nigro wrote:
>  From looking at the code, it appears that this is only the case on some
> platforms (including Windows). The Linux implementation of
> FileSystemWatcher uses inotify and appears to handle renaming of files.
>
> Default implementation:
> https://github.com/mono/mono/blob/master/mcs/class/System/System.IO/DefaultWatcher.cs
> Linux (inotify) implementation:
> https://github.com/mono/mono/blob/master/mcs/class/System/System.IO/InotifyWatcher.cs (search
> for "rename" in this file)
>
>
> On Fri, Nov 9, 2012 at 2:03 PM, edward.harvey.mono
> <edward.harvey.mono at clevertrove.com
> <mailto:edward.harvey.mono at clevertrove.com>> wrote:
>
>     I don't know if anyone will care, but I observed a difference in
>     behavior between mono 2.10.9 on windows, and .Net 4.0.____
>
>     __ __
>
>     When you rename a file, in mono, FileSystemWatcher triggers a
>     WatcherChangeTypes.Created and WatcherChangeTypes.Deleted event.____
>
>     In .Net, it triggers a WatcherChangeTypes.Renamed event.____
>
>     __ __
>
>     While it is conceivable in some cases you might prefer to have the
>     Created & Deleted events, there's one really solid situation *not*
>     to want that.If you are using FileSystemWatcher to keep some
>     directory mirrored, following changes of some source directory, then
>     Created & Deleted events mean you have to copy the file from source
>     to destination and delete the old one.Whereas, a Renamed event can
>     be replicated for much lower cost; all you need to do is perform the
>     Rename operation on the destination.____
>
>
>     _______________________________________________
>     Mono-list maillist  - Mono-list at lists.ximian.com
>     <mailto:Mono-list at lists.ximian.com>
>     http://lists.ximian.com/mailman/listinfo/mono-list
>
>
>
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>




More information about the Mono-list mailing list