Skip to content

[release/9.0-staging] Fix Linux FileSystemWatcher silent stop after unpaired IN_MOVED_FROM - #134335

Merged
artl93 merged 1 commit into
release/9.0-stagingfrom
copilot/backport-fix-to-release-9-0
Sep 23, 2026
Merged

artl93 merged 1 commit into
release/9.0-stagingfrom
copilot/backport-fix-to-release-9-0

Conversation

Copilot AI commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Customer Impact

The customer built a version-control system on .NET and relies on FileSystemWatcher to detect changes in users’ working trees.
On Linux, a merge that moves directories on both sides can silently stop the watcher, disabling change detection for every workspace open in the process with no error or indication that the watcher has failed.
Expected: the watcher continues reporting changes or raises an Error so the application can recover.

Regression

  • Yes

Most likely Introduced by #9130 in .NET 9. It's not reproducible with .NET 11, because FileSystemWatcher got rewritten.

Testing

Verified using the customer-provided repro app from the issue.

No automated regression test was added because it would be flaky and since this component got rewritten in .NET 11, it's very unlikely for us to regress this code path in servicing branch.

Risk

Low. The change is a single-line, minimal-diff fix (return false → break)
confined to one foreach loop inside the Linux inotify event-processing state
machine. It only affects the narrow error/cleanup path for an unmatched
IN_MOVED_FROM event on a previously-watched subdirectory; the rest of the
control flow (watch removal, event dispatch, loop state reset) is unchanged.

Fixes #133420

Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Copilot AI changed the title [release/9.0-staging] Backport fix for Linux FileSystemWatcher silent stop after unpaired IN_MOVED_FROM [release/9.0-staging] Fix Linux FileSystemWatcher silent stop after unpaired IN_MOVED_FROM Sep 21, 2026
Copilot AI requested a review from adamsitnik September 21, 2026 12:21
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@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.

@adamsitnik
adamsitnik marked this pull request as ready for review September 21, 2026 12:42
@adamsitnik
adamsitnik requested review from jozkee and a lite review from Copilot September 21, 2026 12:42
@adamsitnik adamsitnik added the Servicing-consider Issue for next servicing release review label Sep 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The focused control-flow fix preserves watcher processing after stale-watch cleanup.

Review effort: Lite
Findings: None

What changed in this PR

Fixes a Linux FileSystemWatcher issue where an unmatched directory rename could permanently stop event processing.

Changes:

  • Replaces an unintended method return with a loop break.
  • Allows stale-watch cleanup and subsequent event processing to continue.
File Description
src/​libraries/​System.IO.FileSystem.Watcher/​src/​System/​IO/​FileSystemWatcher.Linux.cs Corrects control flow during unmatched directory rename handling.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Copilot AI commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

One or more custom setup steps configured for this repository failed during this Copilot code review run:

Install Dependencies

Setup steps run before each review. If the review above is missing context, or no review was posted at all, the failing step above may be the cause. See the workflow run for failure details, fix your setup steps configuration, and re-request a review.

Note

You can configure setup steps for Copilot code review separately from Copilot cloud agent with a copilot-code-review.yml file. Read the docs for details.

@adamsitnik
adamsitnik requested a review from artl93 September 22, 2026 09:37
@adamsitnik adamsitnik added this to the 9.0.x milestone Sep 22, 2026
@rbhanda rbhanda modified the milestones: 9.0.x, 9.0.22 Sep 22, 2026
@rbhanda rbhanda added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Sep 22, 2026
@artl93

artl93 commented Sep 22, 2026

Copy link
Copy Markdown
Member

@adamsitnik - please check build analysis.

@adamsitnik

adamsitnik commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

/ba-g the build analysis shows two failures and both of them are known and unrelated (I have no idea why BA is red despite this)

image

@artl93
artl93 merged commit b9655fb into release/9.0-staging Sep 23, 2026
104 of 113 checks passed
@artl93
artl93 deleted the copilot/backport-fix-to-release-9-0 branch September 23, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.IO Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants