Skip to content

FileSystemWatcher.Linux: raise Error event when FileSystemWatcher's watched directory is deleted or moved.#128360

Open
tmds wants to merge 4 commits into
dotnet:mainfrom
tmds:fsw-detect-root-delete
Open

FileSystemWatcher.Linux: raise Error event when FileSystemWatcher's watched directory is deleted or moved.#128360
tmds wants to merge 4 commits into
dotnet:mainfrom
tmds:fsw-detect-root-delete

Conversation

@tmds
Copy link
Copy Markdown
Member

@tmds tmds commented May 19, 2026

Fixes #126295.

@tmds tmds requested review from adamsitnik and svick May 19, 2026 09:08
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label May 19, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.


if (dir.IsRootDir && !watcher.IsWatcherStopped)
{
watcher.QueueError(new DirectoryNotFoundException(SR.FSW_WatchedDirectoryDeletedOrMoved));
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what the preferable exception type is here.

From #126295, on Windows the exception thrown is: System.ComponentModel.Win32Exception (5): Access is denied.

@tmds tmds force-pushed the fsw-detect-root-delete branch 2 times, most recently from d6c5db1 to 9a6bf71 Compare May 19, 2026 09:30
@tmds tmds force-pushed the fsw-detect-root-delete branch from 9a6bf71 to e5d13ca Compare May 19, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.IO community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FileSystemWatcher does not detect watched directory deletion on Linux

1 participant