Skip to content

Commit 1315ec0

Browse files
committed
Need to cancel when subdir deleted
github.com/dotnet/pull/124716#discussion_r2838974245
1 parent e0a4818 commit 1315ec0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/libraries/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.SunOS.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,9 @@ private void HandleDirectoryEvent()
526526
}
527527
catch (DirectoryNotFoundException)
528528
{
529-
// Directory was deleted
529+
// Directory was deleted; cancel this instance to prevent indefinite blocking in PortGet.
530+
// The parent watcher (if any) will raise the Deleted event.
531+
Cancel();
530532
return;
531533
}
532534
catch (Exception ex)

0 commit comments

Comments
 (0)