[release/11.0.1xx-preview6] [build] Fix NuGet migration race condition workaround (#25849) - #25960
Merged
dalexsoto merged 1 commit intoJul 7, 2026
Conversation
…n workaround (#25849) The previous workaround (from #25797) ran `dotnet --info` after downloading the SDK to trigger NuGet's first-time migration and avoid the race condition described in dotnet/runtime#91987. However, `dotnet --info` doesn't reliably trigger the migration code path -- the migration (`MigrationRunner.Run()`) is invoked from: 1. `DotnetFirstTimeUseConfigurer` in the dotnet CLI (first-use flow, which `--info` may bypass) 2. `NuGetSdkResolver` during MSBuild SDK resolution (only during build/restore) This PR replaces the `dotnet --info` call with directly creating the NuGet migration marker file (`~/.local/share/NuGet/Migrations/1`). When this file exists, NuGet's `MigrationRunner` returns immediately without acquiring the "NuGet-Migrations" mutex -- completely eliminating the race condition. The migration itself (`Migration1`) only cleans up old NuGet directories, which is a no-op on a fresh SDK installation, so skipping it is safe. Ref: dotnet/runtime#91987 Ref: https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Common/Migrations/MigrationRunner.cs --- 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dalexsoto
approved these changes
Jul 7, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the build-time workaround for the NuGet first-time migration race (dotnet/runtime#91987) in the release/11.0.1xx-preview6 branch by creating NuGet’s migration marker file directly after installing the SDK.
Changes:
- Adds a CI-only (ACES-gated) step in the .NET SDK download/install rule to create
~/.local/share/NuGet/Migrations/1, avoiding NuGet’s migration mutex contention.
dalexsoto
deleted the
dev/rolf/backport-pr-25849-release/11.0.1xx-preview6-2026-07-07
branch
July 7, 2026 15:37
Collaborator
🔥 [PR Build #$(fix_c] Build failed (Build packages) 🔥Build failed for the job 'Build packages' (with job status 'Failed') Pipeline on Agent |
rolfbjarne
added a commit
that referenced
this pull request
Jul 10, 2026
…und (#25996) The previous workaround (from #25797) ran `dotnet --info` after downloading the SDK to trigger NuGet's first-time migration and avoid the race condition described in dotnet/runtime#91987. However, `dotnet --info` doesn't reliably trigger the migration code path -- the migration (`MigrationRunner.Run()`) is invoked from: 1. `DotnetFirstTimeUseConfigurer` in the dotnet CLI (first-use flow, which `--info` may bypass) 2. `NuGetSdkResolver` during MSBuild SDK resolution (only during build/restore) This PR replaces the `dotnet --info` call with directly creating the NuGet migration marker file (`~/.local/share/NuGet/Migrations/1`). When this file exists, NuGet's `MigrationRunner` returns immediately without acquiring the "NuGet-Migrations" mutex -- completely eliminating the race condition. The migration itself (`Migration1`) only cleans up old NuGet directories, which is a no-op on a fresh SDK installation, so skipping it is safe. Ref: dotnet/runtime#91987 Ref: https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Common/Migrations/MigrationRunner.cs --- 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Backport of #25960. Backport of #25849. --------- Co-authored-by: Rolf Bjarne Kvinge <rokvin@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
The previous workaround (from #25797) ran
dotnet --infoafter downloading the SDK to trigger NuGet's first-time migration and avoid the race condition described in dotnet/runtime#91987. However,dotnet --infodoesn't reliably trigger the migration code path -- the migration (MigrationRunner.Run()) is invoked from:DotnetFirstTimeUseConfigurerin the dotnet CLI (first-use flow, which--infomay bypass)NuGetSdkResolverduring MSBuild SDK resolution (only during build/restore)This PR replaces the
dotnet --infocall with directly creating the NuGet migration marker file (~/.local/share/NuGet/Migrations/1). When this file exists, NuGet'sMigrationRunnerreturns immediately without acquiring the "NuGet-Migrations" mutex -- completely eliminating the race condition.The migration itself (
Migration1) only cleans up old NuGet directories, which is a no-op on a fresh SDK installation, so skipping it is safe.Ref: dotnet/runtime#91987
Ref: https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Common/Migrations/MigrationRunner.cs
🤖 Pull request created by Copilot