Fix MSBuild race condition in StartupHook build reference#8976
Draft
Fix MSBuild race condition in StartupHook build reference#8976
Conversation
Copilot
AI
changed the title
[WIP] Fix known race condition in build process
Fix MSBuild race condition in StartupHook build reference
Feb 18, 2026
wiktork
reviewed
Feb 18, 2026
Add OutputItemType="" and SkipGetTargetFrameworkProperties="true" to the ProjectReference for Microsoft.Diagnostics.Monitoring.StartupHook in dotnet-monitor.csproj. This prevents parallel build race conditions where multiple processes try to access the StartupHook.dll file simultaneously. Fixes #8555 Co-authored-by: wiktork <15879456+wiktork@users.noreply.github.com>
When using SkipGetTargetFrameworkProperties="true", we need to explicitly specify the TargetFramework in AdditionalProperties to avoid target framework resolution errors. This ensures the StartupHook is built with net6.0 as expected. Addresses feedback from @wiktork Co-authored-by: wiktork <15879456+wiktork@users.noreply.github.com>
dc8ba1e to
1c1c2eb
Compare
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.
Summary
Parallel builds were hitting a file access race condition on
Microsoft.Diagnostics.Monitoring.StartupHook.dll. AddedOutputItemType=""andSkipGetTargetFrameworkProperties="true"to theProjectReferencewithTargets="Publish"to prevent MSBuild from creating cross-project dependencies that cause simultaneous file access. Additionally, explicitly setTargetFramework=$(StartupHookTargetFramework)inAdditionalPropertiesto ensure proper target framework resolution when usingSkipGetTargetFrameworkProperties="true".Release Notes Entry
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.