Repository navigation
Normalize project paths in Arcade Build.proj restore exclude - #6867
Merged
akoeplinger merged 1 commit intoMay 27, 2026
Merged
Conversation
The Exclude="@(_ProjectToRestoreWithNuGet)" was a literal item-spec
compare, so user-supplied paths with redundant separators (e.g.
'/repo//src/foo.csproj') would not match the NuGet-normalized paths
returned by _IsProjectRestoreSupported. The project then ended up in
_ProjectToRestore twice and was restored in parallel, racing on
project.assets.json and producing the flaky:
error : The file '.../project.assets.json' already exists.
Project the items through %(FullPath) on both sides so the comparison
is path-form-independent.
Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens Arcade’s toolset restore orchestration by normalizing project paths before performing MSBuild item-spec exclusion, preventing the same project from being restored twice (and racing on project.assets.json) when callers pass non-canonical paths (e.g., redundant separators).
Changes:
- Normalize both
@(ProjectToBuild)and@(_ProjectToRestoreWithNuGet)through%(FullPath)when computing_ProjectToRestore. - Expand the inline comment to document the underlying path-comparison pitfall and the parallel-restore race it can trigger.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ViktorHofer
approved these changes
May 27, 2026
Member
Author
|
/backport to release/10.0.1xx |
Contributor
|
Started backporting to |
mthalman
pushed a commit
to mthalman/dotnet
that referenced
this pull request
Jun 2, 2026
…6867) Co-authored-by: Copilot <[email protected]>
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.
Problem
The
Exclude="@(_ProjectToRestoreWithNuGet)"inMicrosoft.DotNet.Arcade.Sdk/toolset/Build.projdoes a literal item-spec comparison. When a caller passes a project path with redundant separators (e.g. a build script that does$repo_root/foowhile$repo_rootalready ends in/, producing/repo//foo), the path differs from the NuGet-normalized form returned by_IsProjectRestoreSupported. The Exclude misses, the project ends up in_ProjectToRestoretwice, and MSBuild kicks off two parallelRestoreinvocations against the same graph.Both restores then race to commit the same
project.assets.jsonviaFile.Move(overwrite: true), which is non-atomic on Linux, producing the flaky:This was observed in a VMR build of
src/fsharpwhereeng/build.shpasses$repo_root/src/Microsoft.FSharp.Compiler/Microsoft.FSharp.Compiler.fsproj(with$repo_rootalready trailing-slashed byeng/common/tools.sh), producing a double slash. TwoRestoreTaskinvocations both started within ~28 ms of each other and raced onFSharp.DependencyManager.Nuget's assets file.Fix
Project both sides of the Exclude through
%(FullPath), which applies MSBuild's path normalization (collapses//, resolves./.., normalizes separators). The comparison then no longer depends on the caller passing a canonical path, protecting every Arcade-using repo from this class of flaky parallel-restore failure.No behavior change for callers that already pass canonical paths.