-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileSystemWatcher doesn't trigger Deleted event for file when watched directory is deleted on OSX #44484
Comments
This appears to be unique to only when the root-level watched directory is removed. If a directory underneath the root directory is removed then the deleted event is observed. I've updated the sample above to better illustrate this. |
It was my understanding that I remembered that fact from this closed issue, from which I learned that not even Windows reports events from the monitored directory itself. That is how the behavior is described in the Windows API we invoke: https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-readdirectorychangesw |
@ericstj the sample you provided behaves similar to what you describe on Windows and Linux, is there something that I am missing?
|
This failure is specific to Mac (OSX) which uses a different implementation. On Mac the last deleted event will be missing. |
I see now, it is reporting Create twice and not reporting Delete when you erase the root as you mentioned:
|
Description
Create a FileSystemWatcher that watches a directory.
Create a file in that directory and observe Created event.
Delete the file and observe Deleted event.
Create another file in that directory and observe Created event.
Delete the directory, and no deleted event ever arrives.
Configuration
Regression?
Not a regression, but different than other platforms
Other information
May be similar to #30415
Discovered when working on #41426
Repro:
The text was updated successfully, but these errors were encountered: