FileSystemWatcher not reporting file moves on Mac OSX 10.15 Catalina
One test failing from System.IO.FileSystem.Watcher.Tests on Mac Catalina:
<test name="System.IO.Tests.File_Move_Tests.File_Move_From_Unwatched_To_Watched" type="System.IO.Tests.File_Move_Tests" method="File_Move_From_Unwatched_To_Watched" time="4.1481931" result="Fail">
<failure exception-type="Xunit.Sdk.TrueException">
<message><![CDATA[Created event did not occur as expected\nExpected: True\nActual: False]]></message>
<stack-trace><![CDATA[ at System.IO.Tests.FileSystemWatcherTest.ExecuteAndVerifyEvents(FileSystemWatcher watcher, WatcherChangeTypes expectedEvents, Action action, Boolean assertExpected, String[] expectedPaths, Int32 timeout) in /Users/dotnet/Documents/dotnet/corefx/src/System.IO.FileSystem.Watcher/tests/Utility/FileSystemWatcherTest.cs:line 272
at System.IO.Tests.FileSystemWatcherTest.ExpectEvent(FileSystemWatcher watcher, WatcherChangeTypes expectedEvents, Action action, Action cleanup, String[] expectedPaths, Int32 attempts, Int32 timeout) in /Users/dotnet/Documents/dotnet/corefx/src/System.IO.FileSystem.Watcher/tests/Utility/FileSystemWatcherTest.cs:line 182
at System.IO.Tests.FileSystemWatcherTest.ExpectEvent(FileSystemWatcher watcher, WatcherChangeTypes expectedEvents, Action action, Action cleanup, String expectedPath, Int32 attempts, Int32 timeout) in /Users/dotnet/Documents/dotnet/corefx/src/System.IO.FileSystem.Watcher/tests/Utility/FileSystemWatcherTest.cs:line 152
at System.IO.Tests.File_Move_Tests.FileMove_FromUnwatchedToWatched(WatcherChangeTypes eventType) in /Users/dotnet/Documents/dotnet/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Move.cs:line 164
at System.IO.Tests.File_Move_Tests.File_Move_From_Unwatched_To_Watched() in /Users/dotnet/Documents/dotnet/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Move.cs:line 55]]></stack-trace>
</failure>
</test>
Is this consistently failing on Catalina? Is it consistently passing on MOjave?
Constantly failing on Catalina for all branches. Run tests on Mojave only once and it didn't fail
OK. I think this is a low priority to investigate as long as the other tests in this area pass.
cc @JeremyKuhne in case he thinks this is of 3.0 concern.
@buyaa-n can you please put up a gist with the full results for this library, it might make it clearer what's special about this one.
Also you might re-run with the security setting that makes the memory mapped files tests pass. That would be interesting
@buyaa-n can you please put up a gist with the full results for this library, it might make it clearer what's special about this one.
Here: https://gist.github.com/buyaa-n/94e359347d2a88bd44a5afc2f57f5ad8
Also you might re-run with the security setting that makes the memory mapped files tests pass. That would be interesting
I did run all tests but that change didn't fixed this. But i still suspect there is some other security restriction as i tried to find out what event it is firing instead of Create, turns out it is not firing any event. I have increased timeout long enough, still not firing any event, guess that means the file didn't move at all
FYI: also reproes on my Catalina
The file were moved successfully, just Created event is not get fired anymore for File.Move(source, target) action (though Deleted event still firing for old path). For 10.15 only, i am thinking to disable this test for Mac OS for now as fix for this would need more effort and most likely area the area owners look into it.
How this sounds @JeremyKuhne @danmosemsft
Does this affect the customer. In other words does the customer get exposed to this kind of variation or is FSW supposed to be hiding it from them..
As it is a public class and public API it could impact customers in case they have event handler listening for Create event. As far as i seen File.Move(source, target) action should trigger Create event for target path and Delete event for source path, which the test is testing and failing for Create event. FSW is exposing/triggering this events for customer's use, so it is a valid bug need to be fixed. I am not sure if I should keep looking and try to fix the bug or hand it to the owner and disable the test until it fixed. Of course I could continue looking, but not sure how fast be able to solve it
Turns out Mac OS not triggering Create event for File.Move(source, target) action which it was triggering in previous versions on OSX like this:
kFSEventStreamEventFlagItemCreated, kFSEventStreamEventFlagItemIsFile, kFSEventStreamEventFlagItemIsHardlink
But OSX 10.15 is triiggering only kFSEventStreamEventFlagRootChanged instead of above. I am not sure if this could be counted as OS bug or it is by their design and we need to adjust our event parsers accordingly. For me it seems OS bug, if that is the case there is nothing to do about it from corefx side
@buyaa-n does the documentation say anything about this behavior? I'd recommend disabling the tests first and once you're done with filing issues then start looking at them 1 by 1 focusing on areas you own or co-own and for the remainder limit the time you spend on them (if you have 60 issues it probably doesn't make sense to spend more than an 1h on 1)
@buyaa-n does the documentation say anything about this behavior?
Docs i have seen so far doesn't say specifically say what File.Move() should trigger
I'd recommend disabling the tests first and once you're done with filing issues then start looking at them 1 by 1 focusing on areas you own or co-own and for the remainder limit the time you spend on them (if you have 60 issues it probably doesn't make sense to spend more than an 1h on 1)
Well actually this is the last open issue i have created for Mac compatablity 😄, have already spent some time on it, and above result is end of my investigation, yeah am not planning to go further and @JeremyKuhne suggested the same plus mark the issue up for grabs, i will disable OSX test with a link to this issue
After it's fixed please remove OS version conditional check from the test https://github.com/dotnet/corefx/pull/40332/files#diff-738a1650d713fef5b8711a5e00967ecdR57
👀 This is failing a dotnet-watch test in ASP.NET Core
LastAccess change is also not working on Catalina, currently I have tools I use almost daily on my main mac running Mojave. This issues is currently preventing me from upgrading to Catalina which sucks!
@cyperous could you please open a separate issue for that? It would be ideal, if you'd like to help, to include what events ARE firing if any. If they're not firing an event at all any more, then it would be a bug for Apple.
is this issue still open for Catalina? it's a pretty big deal for anybody working on filesync applications.
There is a workaround that I have found, not sure if it would solve your particular issue.
https://github.com/dotnet/runtime/issues/31194
https://github.com/dotnet/runtime/issues/31194#issuecomment-548244074
I really only noticed an issue in Catalina when trying to watch files or directories that were on an APFS volume. For me, I was trying to watch files for changes (aka monitor access times) on an external drive that was formatted with APFS.
The workaround was to run this (sudo mount -vuwo strictatime /Volumes/Drive) on the mounted drive.
There is a workaround that I have found, not sure if it would solve your particular issue.
#31194
I really only noticed an issue in Catalina when trying to watch files or directories that were on an APFS volume. For me, I was trying to watch files for changes (aka monitor access times) on an external drive that was formatted with APFS.
The workaround was to run this (
sudo mount -vuwo strictatime /Volumes/Drive) on the mounted drive.
I wouldn't consider this a feasible workaround for those that are shipping software. It is unlikely that you'll get a customer to change their mount options for a given drive, especially a system mounted one.
@mattdefoor True, that's why I said
not sure if it would solve your particular issue.
Unforchantly, if that does fix the issue while debugging, it means that there is not much the dotnet team can do. It's an Apple ecosystem bug, not a dotnet bug.