Commit 3024b5a
Skip flaky FileConfigurationProvider test on .NET Framework (#126874)
> [!NOTE]
> This PR was AI/Copilot-generated.
Fixes #126787
## Problem
The
`ResolveFileProvider_WithMissingParentDirectory_WatchTokenFiresWhenFileCreated`
test introduced in #126411 is flaky on the `net481-windows-Release-x86`
CI leg, causing it to time out and block CI.
## Root cause
`FileSystemWatcher` on .NET Framework drops directory creation events
under I/O contention. The `PendingCreationWatcher` in
`PhysicalFilesWatcher` relies on FSW to detect when a missing root
directory is created. When the FSW event is lost, the change token never
fires and the test hangs.
This was verified by:
1. **Reproducing locally** — running the test in parallel (4-8
concurrent `dotnet test` processes) reproduces the hang on net481 x86
(~3% failure rate).
2. **Isolating to raw FSW** — a minimal test using only
`FileSystemWatcher` (no `PendingCreationWatcher`) also fails under the
same conditions on .NET Framework.
3. **Confirming .NET is unaffected** — 504 runs on net11.0 x86 with 8
concurrent threads produced 0 failures.
All 7 CI failures in the issue report are on the same
`net481-windows-Release-x86-NET481_Release-Windows.10.Amd64.Client.Open`
configuration.
## Changes
- **Skip on .NET Framework**: Changed `[Fact]` to
`[ConditionalFact(typeof(PlatformDetection),
nameof(PlatformDetection.IsNotNetFramework))]` since the test depends on
FSW reliability that .NET Framework cannot guarantee under load.
- **Improved timeout**: Replaced `CancellationTokenSource`-based timeout
with `Task.WaitAsync(TimeSpan)` (via `TaskTimeoutExtensions` polyfill)
and added `TaskCreationOptions.RunContinuationsAsynchronously` —
matching the pattern used by all similar tests in
`PhysicalFilesWatcherTests`.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent 1b31de7 commit 3024b5a
2 files changed
Lines changed: 7 additions & 7 deletions
File tree
- src/libraries/Microsoft.Extensions.Configuration.FileExtensions/tests
Lines changed: 5 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| |||
114 | 113 | | |
115 | 114 | | |
116 | 115 | | |
117 | | - | |
| 116 | + | |
| 117 | + | |
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
| 153 | + | |
| 154 | + | |
157 | 155 | | |
158 | 156 | | |
159 | 157 | | |
160 | 158 | | |
161 | 159 | | |
162 | 160 | | |
163 | 161 | | |
164 | | - | |
| 162 | + | |
165 | 163 | | |
166 | 164 | | |
167 | 165 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
0 commit comments