Fix flaky FileSystemWatcher_SymbolicLink_TargetsDirectory_Create_IncludeSubdirectories test#125682
Fix flaky FileSystemWatcher_SymbolicLink_TargetsDirectory_Create_IncludeSubdirectories test#125682
Conversation
|
Tagging subscribers to this area: @dotnet/area-system-io |
…udeSubdirectories test Add expectedPath filter to ExpectNoEvent call so spurious Create events from setup (e.g. subDir created just before the FSEvents stream started) do not cause false test failures on macOS. Change [ActiveIssue] to be OSX-specific since the root cause is macOS FSEvents delivering late events near the kFSEventStreamEventIdSinceNow boundary, and the test now runs cleanly on Linux/Windows. Co-authored-by: danmoseley <6385855+danmoseley@users.noreply.github.com>
|
@copilot remove the ActiveIssue, since the point of this change is to fix and enable the test. |
|
also @copilot it might be helpful to add some comments around here with examples of each of these path variables ot help readers. |
There was a problem hiding this comment.
Pull request overview
Improves reliability and coverage of the FileSystemWatcher_SymbolicLink_TargetsDirectory_Create_IncludeSubdirectories test by reducing false failures from unrelated Created events and ensuring the test is only skipped on the affected platform.
Changes:
- Scope
ExpectNoEventto only fail when aCreatedevent occurs for the specific nested directory path under test. - Restrict the existing
[ActiveIssue]skip toTestPlatforms.OSXso the test runs on Windows/Linux.
src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.SymbolicLink.cs
Show resolved
Hide resolved
…ate_IncludeSubdirectories test The expectedPath fix makes the test robust enough to run on all platforms. Co-authored-by: danmoseley <6385855+danmoseley@users.noreply.github.com>
Co-authored-by: danmoseley <6385855+danmoseley@users.noreply.github.com>
... Added a disk-layout diagram and inline comments on each path variable in 483c78c. The comments now show the relationship between |
Description
FileSystemWatcher_SymbolicLink_TargetsDirectory_Create_IncludeSubdirectorieswas consistently flaky on macOS, failing withAggregateException: (Expected Event occurred) × 3from theExpectNoEventassertion.Root cause: macOS FSEvents can deliver a late
Createdevent forsubDir(created during test setup, just before the stream starts atkFSEventStreamEventIdSinceNow). SincesubDiris a direct child of the watched path, it correctly passesCheckIfPathIsNestedeven withIncludeSubdirectories = false. With noexpectedPathfilter onExpectNoEvent, anyCreatedevent triggered the failure—including this unrelated one.Changes:
ExpectNoEvent— add path filter: PassexpectedPath: Path.Combine(linkPath, subDir, subDirLv2)so the assertion only fails if aCreatedevent fires at the specific nested path under test. Spurious events at sibling paths (e.g.subDiritself) are ignored.[ActiveIssue]— removed: The[ActiveIssue]attribute has been removed entirely. TheexpectedPathfix makes the test robust enough to run on all platforms without skipping.tempDir,tempSubDir,linkPath, andsubDirLv2Path. Each path variable andexpectedPathargument is annotated with its concrete resolved value (e.g.// linkPath/subDir/subDirLv2) to make the test easier to follow.Security
No security-relevant changes.
Original prompt
This section details on the original issue you should resolve
<issue_title>FileSystemWatcher_SymbolicLink_TargetsDirectory_Create_IncludeSubdirectories failed with missed event</issue_title>
<issue_description>## Build Information
Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=1302001
Build error leg or test failing: System.IO.Tests.SymbolicLink_Changed_Tests.FileSystemWatcher_SymbolicLink_TargetsDirectory_Create_IncludeSubdirectories
Pull request: #124628
Error Message
Fill the error message using step by step known issues guidance.
{ "ErrorMessage": "System.AggregateException : One or more errors occurred. (Expected Event occurred) (Expected Event occurred) (Expected Event occurred)", "ErrorPattern": "", "BuildRetry": false, "ExcludeConsoleLog": false }Known issue validation
Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1302001
Error message validated:
[One or more errors occurred]Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 2/20/2026 8:56:47 PM UTC
Report
Summary
Known issue validation
Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1302001
Error message validated:
[System.AggregateException : One or more errors occurred. (Expected Event occurred) (Expected Event occurred) (Expected Event occurred)]Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 2/20/2026 11:20:21 PM UTC
Report
Summary
Report
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.