Skip to content

Capture WER LocalDumps for crossgen2 on Windows VMR builds (diagnose dotnet/runtime#125699) - #7279

Merged
AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:wer-dumps-crossgen2-125699
Jun 19, 2026
Merged

AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:wer-dumps-crossgen2-125699

Conversation

@AndyAyersMS

Copy link
Copy Markdown
Member

Why

dotnet/runtime#125699 tracks an intermittent crash of the shipped crossgen2 during the SDK crossgen layout step (Crossgen.targets(171,5)). Each recurrence FailFasts at the exact same site:

   at ILCompiler.ProfileDataManager.GetAllowSynthesis(Compilation, MethodDesc, Boolean&) + 0x31
   at Internal.JitInterface.CorInfoImpl.getPgoInstrumentationResults(...) + 0xab
   ...

with the symptom alternating between NullReferenceException and AccessViolation — the classic signature of heap/GC corruption rather than a logic bug at that line. So far the crash has only been observed in dotnet-unified-build legs (VMR), across multiple branches and on both Windows_x86 and Windows_x64:

Date Build Branch Leg Error
2026-03-18 1339370 (public) VMR PR dotnet/dotnet#5533 Windows_x86 AV
2026-05-20 2979463 (internal) internal/release/10.0.109 Windows_x86 NRE
2026-06-16 3001312 (internal) release/10.0.4xx Windows_x64 AV

No crash dump was captured in any of these runs — only the textual stack — so we have no way to inspect heap state, thread context, or the offending MethodDesc. Without a dump, root-causing this is essentially blocked.

What this PR does

Adds a pre-build step on the Windows leg of vmr-build.yml that configures Windows Error Reporting LocalDumps for crossgen2.exe:

  • Dump folder: $(Build.ArtifactStagingDirectory)\BuildLogs\crossgen2-dumps
  • DumpType = 2 (MiniDumpWithFullMemory — needed because we suspect heap corruption)
  • DumpCount = 3

The dumps ride out via the existing Publish BuildLogs 1ES output (condition: succeededOrFailed() on $(Build.ArtifactStagingDirectory)/BuildLogs), so no new artifact publish is required.

Cost when crossgen2 doesn't crash

Zero — WER only writes dumps on actual unhandled failfast/AV. The registry write itself takes < 100 ms. continueOnError: true keeps the build robust if a non-admin agent ever runs the leg.

How to remove

Once a dump is captured and dotnet/runtime#125699 is root-caused, revert this commit.

Note

Drafted with AI (GitHub Copilot) assistance.

To diagnose dotnet/runtime#125699, where the shipped crossgen2 has hit a
FailFast/AV in ProfileDataManager.GetAllowSynthesis a handful of times in
the SDK crossgen layout step (Crossgen.targets:171) without ever leaving
behind a dump. Enable WER LocalDumps for crossgen2.exe on the Windows
legs so the next recurrence produces a full minidump that publishes via
the existing BuildLogs artifact.
Copilot AI review requested due to automatic review settings June 18, 2026 00:35
@AndyAyersMS
AndyAyersMS requested review from a team as code owners June 18, 2026 00:35
@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team June 18, 2026 00:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Windows-only pipeline configuration to capture Windows Error Reporting (WER) LocalDumps for crossgen2.exe during VMR builds, so intermittent FailFast/AV crashes in the SDK crossgen layout step can be diagnosed with crash dumps (dotnet/runtime#125699).

Changes:

  • Adds a Windows pre-build pwsh step to configure WER LocalDumps for crossgen2.exe.
  • Routes any generated dumps into $(Build.ArtifactStagingDirectory)\BuildLogs\crossgen2-dumps so they flow out via the existing BuildLogs publishing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AndyAyersMS

Copy link
Copy Markdown
Member Author

Feel free to reject this or suggest alternatives. We've only seen these crashes sporadically.

More generally it would be good to capture crashes from any build tool, especially so ones that we author.

@AndyAyersMS

Copy link
Copy Markdown
Member Author

@mmitche any suggestions on who could review this?

@mmitche mmitche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable. Is this targeting the correct branch though? It looks like 10;0 is where it shows up most?

@AndyAyersMS

Copy link
Copy Markdown
Member Author

Good point. Take this and also port it to 10.0?

@AndyAyersMS
AndyAyersMS merged commit 73aface into dotnet:main Jun 19, 2026
11 checks passed
AndyAyersMS added a commit to AndyAyersMS/dotnet that referenced this pull request Jun 19, 2026
…sgen2

Forward-port of dotnet#7279 to release/10.0.4xx. Diagnoses
dotnet/runtime#125699; the most recent recurrence (build 3001312,
2026-06-16, Windows_x64) was on this branch. The release branch wraps
BuildLogs differently than main (CopyFiles@2 with artifacts/log/**), so
dumps go under sourcesPath\artifacts\log\crossgen2-dumps.
@mmitche

mmitche commented Jun 19, 2026

Copy link
Copy Markdown
Member

/backport to release/10.0.1xx

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/10.0.1xx (link to workflow run)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants