Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report for Bug 14663 on
GitHub or Developer Community if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Created attachment 4847 [details]
From case #45521
Using the example provided, the FileSystemWatcher events aren't being handled properly. Only the Changed event is firing, and the ChangeType is always Changed.
Here is my initial request:
I use Mono on Mac OS X and it seems neither KeventWatcher nor DefaultWatcher implementation of IFileWatcher interface doesn't send Renamed event and thus it is impossible to catch this event when the user renames file or folder. I always get Deleted and Created events successively.
Use MonoMac.CoreServices.FSEvents for now. Here's a sample: https://github.com/xamarin/mac-samples/tree/master/FSEvents
Mono at some point in the future should probably use FSEvents internally for FileSystemWatcher, but it does not. The behavior you are looking for is however available in Xamarin.Mac.
Moving this to Mono itself since this is not a bug in Xamarin.Mac.
Yes, it is what I finally used.
Hi, i would like to fix this. Is anyone
Sorry for my last comment, i would like to fix, i have seen in code that all events are considerated. is this still a problem?
Bug confirmed with Mono 3.10.0 on OS X 10.9.5.
I have created this watcher which inherits from FileSystemWatcher:
Path = System.IO.Path.GetFullPath(folder);
IncludeSubdirectories = true;
Filter = "*";
InternalBufferSize = 4 * 1024 * 16;
NotifyFilter = NotifyFilters.Size |
NotifyFilters.FileName | NotifyFilters.DirectoryName;
Error += new ErrorEventHandler(OnError);
Created += new FileSystemEventHandler(OnCreated);
Deleted += new FileSystemEventHandler(OnDeleted);
Changed += new FileSystemEventHandler(OnChanged);
Renamed += new RenamedEventHandler(OnRenamed);
On both Windows and Mono/OS X, I tried renaming `file.txt` to `file2.txt` at the root of the watched folder.
Works great: I receive one Renamed (name=file2.txt oldName=file.txt).
Unfortunately I receive 3 events:
1. Changed: file.txt
2. Created: file2.txt
3. Deleted: file.txt
Same result with Environment.SetEnvironmentVariable("MONO_MANAGED_WATCHER", "enabled");
This is problematic for my sync software: syncing deletion/creation to remote is inefficient and looses precious file metadata.