[ResourceLock] Replace class-level DoNotParallelize with ResourceLock in TrxLongPathHelperTests - #10718
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Replaces broad test parallelization suppression with a current-directory resource lock.
Changes:
- Applies
WellKnownResources.CurrentDirectory. - Documents lock scope and directory restoration.
Show a summary per file
| File | Description |
|---|---|
TrxLongPathHelperTests.cs |
Narrows current-directory synchronization. |
Review details
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Balanced
| /// </remarks> | ||
| [TestClass] | ||
| [DoNotParallelize] | ||
| [ResourceLock(WellKnownResources.CurrentDirectory)] |
There was a problem hiding this comment.
Good catch — fixed in 5d2cef9. StackTraceSourceLocationResolverTests now takes a read lock on WellKnownResources.CurrentDirectory, so its readers coordinate with the writer lock in TrxLongPathHelperTests. The focused net462 run passed all 9 affected tests.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8e062c95-4074-40aa-979a-f1f3563d30c3
Copilot-Session: 9b40ad18-2680-4d54-b965-8cf41c6df384
Copilot-Session: 6babe228-0d10-48a1-84c8-583f7ff56281
Copilot-Session: daf71962-ce66-4366-8ba6-700a2f0829bf
…: Build ID 3056930 (#10725) Co-authored-by: dotnet-oneloc-localization[bot] <310689744+dotnet-oneloc-localization[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c661d151-50e8-4112-be24-c3144a02580e
Copilot-Session: 64fbc2fa-0f15-4789-b4c9-6c74e6b4c925
Copilot-Session: 05d06302-12f7-4db0-a3a7-8923510820f9
…10731) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…10640) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Amaury Levé <amauryleve@microsoft.com> Copilot-Session: 021b7d71-92b8-40a1-a0ab-5a6d768c5b1a
Copilot-Session: fc14aba1-535f-404f-b2c2-56475e3ace7c
Add a read lock to StackTraceSourceLocationResolverTests so it cannot observe temporary current-directory mutations from TrxLongPathHelperTests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
🧪 Expert test review — PR #10718No new or modified test methods were identified in the changed regions of this PR. The only diff hunk touches the class-level XML Re-run with
|
There was a problem hiding this comment.
Note
🤖 Automated review by GitHub Copilot. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.
✅ 22/22 dimensions clean — no findings.
Scope note: The diff shows 119 changed files / ~3700 additions, but the PR's own unique changes (commits 64d4964 and 5d2cef9) touch only 2 test files. The rest is from merging main into the branch. This review covers the PR-specific changes:
-
TrxLongPathHelperTests.cs— Replaces[DoNotParallelize]with[ResourceLock(WellKnownResources.CurrentDirectory)](write mode, the default). Remarks updated to explain the narrower serialization. Correct: both test methods mutate and restore the current directory infinallyblocks, so a per-method resource lock serializes the mutations without suppressing unrelated parallel tests. -
StackTraceSourceLocationResolverTests.cs— Adds[ResourceLock(WellKnownResources.CurrentDirectory, Mode = ResourceAccessMode.Read)]. Correct: this class reads the current directory (via relative path resolution) and would be affected by concurrent mutations fromTrxLongPathHelperTests. The read lock serializes against writers while still allowing other readers to run in parallel.
Both changes are well-motivated, correctly scoped, and the #if !NETCOREAPP guard on the TRX tests means there is no cross-TFM risk on .NET Core/5+. The class is only compiled for net462/net472.
| _ValidateBundledSdkFeatureVersions target (in Directory.Build.targets) fails the build if | ||
| the two drift apart. --> | ||
| <AspireHostingTestingVersion>13.4.6</AspireHostingTestingVersion> | ||
| <AspireHostingTestingVersion>13.5.2</AspireHostingTestingVersion> |
Summary
Microsoft.Testing.Extensions.UnitTestsproject, replace the class-level[DoNotParallelize]onTrxLongPathHelperTestswith[ResourceLock(WellKnownResources.CurrentDirectory)].finally; the class-level lock is reacquired for each method and serializes those conflicting mutations without suppressing unrelated parallel tests.Validation
bash ./build.sh— succeeded with 0 errors and 0 warnings.#if !NETCOREAPPand therefore only builds fornet462/net472, which could not run on the Linux workflow runner. Anet8.0--filter-uidprobe confirmed that no matching tests are compiled for that target framework.Recovered from the safe-output failure in https://github.com/microsoft/testfx/actions/runs/32812234406.