Isolate the MSBuild debug-log directory per test process - #15005
Merged
Merged
Conversation
AR-May
marked this pull request as ready for review
September 11, 2026 14:52
AR-May
had a problem deploying
to
copilot-pat-pool
September 11, 2026 14:54 — with
GitHub Actions
Failure
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Path normalization and best-effort error handling still need correction.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This pull request isolates MSBuild debug logs per test process while preserving CI artifact collection.
Changes:
- Adds a
test_<pid>debug-log subdirectory. - Refreshes the cached framework debug path.
File summaries
| File | Summary |
|---|---|
src/Shared/UnitTests/TestAssemblyInfo.cs |
Configures process-specific debug logging during test startup. |
Review details
Suppressed comments (1)
src/Shared/UnitTests/TestAssemblyInfo.cs:261
SetDebugPath()can throw when the configured path is invalid, inaccessible, or becomes too long after addingtest_<pid>; its static constructor explicitly catches these failures so MSBuild can continue. Calling it directly here makes test-process startup fail for those environments, so keep this re-resolution best-effort and preserve a safe fallback if nested-directory creation fails.
// Lets re-resolve FrameworkDebugUtils.DebugPath, which is cached, so it picks up new MSBUILDDEBUGPATH
FrameworkDebugUtils.SetDebugPath();
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Arcade sets MSBUILDDEBUGPATH once per build (eng/common/tools.ps1) to $LogDir/MsbuildDebugLogs. Since dotnet#14224 BuildFailureLogInvariant also scans FrameworkDebugUtils.DebugPath, which resolves to that single shared folder in every test process. Test assemblies run in parallel, and the invariant deletes the files it considers new, so parallel processes saw and destroyed each other's MSBuild_*.txt files - producing flaky failures in both directions. Give each test process its own subfolder, nested under the Arcade path so the logs are still published as a CI artifact. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
SetDebugPath reads the variable through FileUtilities.TrimAndStripAnyQuotes. Reading it raw here appended the suffix after a trailing quote, stranding that quote mid-path where Trim can no longer reach it, and let a whitespace-only value through as a relative path. Normalize first so both cases are handled. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
AR-May
force-pushed
the
ar-may-isolate-test-debug-path
branch
from
September 11, 2026 15:45
cfed17f to
e95783b
Compare
rainersigwald
approved these changes
Sep 11, 2026
Member
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
AR-May
enabled auto-merge (squash)
September 11, 2026 16:47
Member
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue(s):
Context
BuildFailureLogInvariantflakes inmsbuild-prCI, in both directions (Expected: 1, Actual: 2andExpected: 2, Actual: 1).It scans three directories for
MSBuild_*.txt. Two are process-private; the third —FrameworkDebugUtils.DebugPath, added by #14224 — resolves to the single build-wide folder Arcade sets viaMSBUILDDEBUGPATH. Test assemblies run in parallel as separate processes, andAssertInvariantdeletes files it considers new before applying its benign-file filters, so they destroy each other's files.Changes Made
Give each test process a
test_<pid>subfolder, applying the isolation pattern already used for the temp path just below it.Nested under the Arcade path so the logs are still published as a CI artifact. No-op when the variable is unset.
BuildFailureLogInvariantis deliberately unchanged: once all three scanned directories are process-private, its existing logic is correct as written.