Skip to content

Fix BuildCheck registration crashes in solution and graph evaluation - #15576

Merged
baronfel merged 1 commit into
dotnet:mainfrom
MattKotsenas:bugfix/buildcheck-acquisition-routing
Nov 17, 2026
Merged

baronfel merged 1 commit into
dotnet:mainfrom
MattKotsenas:bugfix/buildcheck-acquisition-routing

Conversation

@MattKotsenas

Copy link
Copy Markdown
Member

Fixes #15548.

Context

Custom BuildCheck registration can reach the central logger before build execution starts, including
during solution evaluation and graph construction. The acquisition handler uses IsInProcNode, which
requires both event and execution data sources to be enabled. Before execution starts, the central
logger forwards the acquisition event back into its own logging path, causing recursive routing and
a stack overflow.

Changes Made

  • Use the existing EventArgs data-source role to consume acquisitions in the central logger and
    replay, including before build execution starts. Workers without that role continue forwarding.
  • Add regression cases that run a real custom check with and without execution enabled, and verify
    forwarding preserves the acquisition paths and event context when EventArgs is disabled.

Compatibility

No public API, event serialization, configuration format, or default changes. Existing acquisition
during build execution and worker-to-central forwarding are preserved.

Testing

Release BuildPack succeeded. Windows net11.0 BuildCheck tests passed (268/268, including four added
cases), and 12 patched-CLI controls passed, covering solution registration, project/solution graph
builds, and out-of-process forwarding. The full repository Release run completed with 111 failures;
no unchanged-source comparison was completed.

Copilot AI balanced review requested due to automatic review settings November 16, 2026 23:05

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.

🔵 Needs a closer look

The full Release test run reports 111 failures without an unchanged-source comparison, requiring human validation to determine whether they predate the build-infrastructure behavior change.

No open issues 🎉

What changed in this PR

Fixes #15548 by allowing the central BuildCheck logger to consume custom-check registrations during solution evaluation and graph construction, preventing recursive event routing before execution starts.

Changes:

  • Use the EventArgs data-source role to determine whether to consume acquisitions locally or forward them.
  • Add four regression cases covering custom-check execution and forwarding, with build execution enabled and disabled.
  • Shut down the test manager and logging service after each test.
File Description
src/​BuildCheck.UnitTests/​BuildCheckManagerProviderTests.cs Adds acquisition and forwarding regression tests, plus cleanup.
src/​Build/​BuildCheck/​Infrastructure/​BuildCheckManagerProvider.cs Consumes acquisitions based on the EventArgs role rather than execution state.

Review effort: Balanced

@baronfel
baronfel merged commit b21148b into dotnet:main Nov 17, 2026
20 checks passed

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 76fc7475 Deployed Nov 16, 2026 by MattKotsenas via pat_pool #1169
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.

Custom BuildCheck registration causes a stack overflow in solution evaluation and graph builds

3 participants