Set MSBUILDDEBUGPATH in common build scripts for crash diagnostics#16715
Merged
danmoseley merged 1 commit intodotnet:mainfrom Apr 14, 2026
Merged
Set MSBUILDDEBUGPATH in common build scripts for crash diagnostics#16715danmoseley merged 1 commit intodotnet:mainfrom
danmoseley merged 1 commit intodotnet:mainfrom
Conversation
Set MSBUILDDEBUGPATH in eng/common/tools.sh and eng/common/tools.ps1 so that MSBuild crash diagnostics (MSB4166 failure.txt files) are written to a known location under artifacts/log/<config>/MsbuildDebugLogs/ instead of the system temp directory. This ensures they are captured as build artifacts in CI. Previously individual repos had to set this in their own build scripts (e.g. dotnet/runtime's src/coreclr/build-runtime.sh, src/tests/build.sh). Putting it in the common tooling covers all repos using arcade infrastructure. Relates to dotnet/runtime#92290 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR improves MSBuild crash diagnostics collection by defaulting MSBUILDDEBUGPATH in Arcade’s shared build tooling to a location under artifacts/log/<configuration>/, which CI already publishes as an artifact—making MSB4166 “failure.txt” outputs available for postmortem analysis.
Changes:
- Set
MSBUILDDEBUGPATH(only if not already defined) ineng/common/tools.sh. - Set
MSBUILDDEBUGPATH(only if not already defined) ineng/common/tools.ps1. - Route MSBuild crash diagnostics to
artifacts/log/<configuration>/MsbuildDebugLogs/.
Show a summary per file
| File | Description |
|---|---|
| eng/common/tools.sh | Exports MSBUILDDEBUGPATH to a stable artifacts log subdirectory when unset. |
| eng/common/tools.ps1 | Sets $env:MSBUILDDEBUGPATH to a stable artifacts log subdirectory when unset. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
hoyosjs
approved these changes
Apr 14, 2026
| # Direct MSBuild crash diagnostics (MSB4166 failure.txt files) to a known location | ||
| # under artifacts/log so they are captured as build artifacts in CI. | ||
| if (-not $env:MSBUILDDEBUGPATH) { | ||
| $env:MSBUILDDEBUGPATH = Join-Path $LogDir 'MsbuildDebugLogs' |
Member
There was a problem hiding this comment.
This also collects them on dev machines - I am not against that anyway.
Member
Author
There was a problem hiding this comment.
yes and I think that's a good thing.
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.
When MSBuild encounters a fatal internal error (MSB4166), it writes a
failure.txtcrash dump file. By default these go to the system temp directory, which CI pipelines typically don't collect as artifacts — making it hard to diagnose intermittent MSBuild crashes in CI.This change sets
MSBUILDDEBUGPATHin arcade's common build scripts (tools.shandtools.ps1) to direct these crash diagnostics toartifacts/log/<configuration>/MsbuildDebugLogs/, which is already collected by CI pipelines.Key design choices:
MSBUILDDEBUGPATHif it isn't already defined, so repo-specific or user overrides are respectedFrameworkDebugUtils.SetDebugPath()creates the directory itself inside a try/catch when needed, avoidingset -erisk in bash and keeping the change minimalMSBUILDDEBUGENGINE=1, only crash dump files are written here (not verbose debug/scheduler logs), so the directory will be empty on healthy buildsSeveral repos (e.g., dotnet/runtime) already set
MSBUILDDEBUGPATHin their own build scripts for specific subcomponents. This change provides the default for all arcade-based repos, filling the gap for top-level builds.Relates to getting data to fix dotnet/runtime#92290 and any other MSBuild crashes in any arcade repos
Supersedes dotnet/runtime#126806