Repository navigation
Fully dedupe aspnetcoretools build to fix NativeAOT sourcelink race - #67327
Merged
wtgodbe merged 1 commit intoJun 20, 2026
Merged
Conversation
PR dotnet#67320 attempted to fix the intermittent ILC sourcelink file lock (aspnetcoretools.sourcelink 'being used by another process') by changing the NativeAot.Tests ProjectReference to pass Properties="TargetFramework=$(DefaultNetCoreTargetFramework)". That was insufficient: the solution traversal builds the single-targeted aspnetcoretools.csproj with NO TargetFramework global property, so passing TargetFramework=net11.0 still produces a differently-keyed MSBuild project instance. The two instances both run a NativeAOT compile concurrently and race on the shared intermediate sourcelink file. Drop the explicit property and UndefineProperties TargetFramework and RuntimeIdentifier so this reference resolves to the same project instance the traversal builds and dedupes onto it. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an intermittent NativeAOT build failure caused by concurrent builds of aspnetcoretools.csproj producing a shared intermediate *.sourcelink file, by ensuring MSBuild can dedupe the ProjectReference build onto the solution traversal’s already-running project instance.
Changes:
- Stop forcing a separately-keyed
aspnetcoretoolsproject instance by removing theProperties="TargetFramework=..."override. - Add
UndefineProperties="TargetFramework;RuntimeIdentifier"on theProjectReferenceso the reference build resolves to the same global-properties set as the traversal build. - Update the inline comment to explain why the dedupe was not happening and how this fixes the race.
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
Fixes the intermittent NativeAOT build failure where
ilcerrors with:Why #67320 wasn't sufficient
#67320 changed the
NativeAot.Tests→aspnetcoretoolsProjectReferenceto passProperties="TargetFramework=$(DefaultNetCoreTargetFramework)", intending to dedupe onto the solution traversal's build. Butaspnetcoretools.csprojis single-targeted, so the solution traversal builds it with noTargetFrameworkglobal property.MSBuild keys a project instance by
(path + global-properties set). PassingTargetFramework=net11.0therefore produces a different key from the traversal's{… no TargetFramework}build, so the two are not deduped — they run two concurrent NativeAOT compiles that race on the shared intermediateaspnetcoretools.sourcelinkfile.Binlog from build
1473385(Tests: Helix x64 Subset 2) confirms two concurrentBuildinstances ofaspnetcoretools.csproj, identical in every global property exceptTargetFramework(one<none>, onenet11.0), with theIOExceptionlanding in theTargetFramework=net11.0instance.Fix
Drop the explicit property and
UndefineProperties="TargetFramework;RuntimeIdentifier"so the reference resolves to the same project instance the traversal builds and dedupes onto it (the reference already setsSkipGetTargetFrameworkProperties="true"). Sequencing intent is preserved via the unchangedReferenceOutputAssembly="false"/Private="false"build-order edge.