Skip to content

Add first on-build restore coordination - #7431

Merged
nkolev92 merged 10 commits into
devfrom
dev-nikolev-buildRestoreCoordination
Sep 17, 2026
Merged

nkolev92 merged 10 commits into
devfrom
dev-nikolev-buildRestoreCoordination

Conversation

@nkolev92

@nkolev92 nkolev92 commented May 29, 2026 •

Copy link
Copy Markdown
Member

Bug

Fixes: NuGet/Home#14927

Description

Visual Studio can start its first on-build restore before solution loading and project nomination have finished. Because on-build restore executes directly rather than through the background restore queue, it could run with incomplete restore inputs and fail when a solution is built immediately after opening.

This change coordinates the first on-build restore with the existing restore-readiness signals. It waits for solution loading, all projects to be nominated, and pending project restore-info sources to finish nomination before starting restore.

The readiness wait uses the existing five-minute bulk coordination timeout as an inactivity fallback. The timeout now starts while waiting for initial project nominations, preventing a project that never nominates from delaying build indefinitely. It resets when nomination work makes progress, allowing large solutions to continue beyond five minutes as long as projects are still advancing. The original coordination start time remains fixed for total-duration telemetry.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

@nkolev92
nkolev92 force-pushed the dev-nikolev-buildRestoreCoordination branch 2 times, most recently from 0abc109 to b3863ca Compare June 3, 2026 23:06
@dotnet-policy-service dotnet-policy-service Bot added the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Jun 10, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

This PR has been automatically marked as stale because it has no activity for 7 days. It will be closed if no further activity occurs within another 7 days of this comment. If it is closed, you may reopen it anytime when you're ready again, as long as you don't delete the branch.

@nkolev92
nkolev92 force-pushed the dev-nikolev-buildRestoreCoordination branch from b3863ca to caac44d Compare September 11, 2026 18:24
@dotnet-policy-service dotnet-policy-service Bot removed the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Sep 11, 2026
nkolev92 and others added 3 commits September 11, 2026 18:37
Prevent the first on-build restore from waiting indefinitely for project nominations. Reset bulk coordination timeout windows when nomination work makes progress so large solutions are not timed out while advancing.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: aec7c3b6-424c-4669-9d0f-16d7b8c7dc97
@nkolev92
nkolev92 marked this pull request as ready for review September 12, 2026 02:03
@nkolev92
nkolev92 requested a review from a team as a code owner September 12, 2026 02:03
Co-authored-by: Copilot <[email protected]>
Copilot-Session: b958dfc0-71dc-4d22-b39e-67763df4f0e8
@nkolev92
nkolev92 requested a review from zivkan September 15, 2026 18:22
@nkolev92

Copy link
Copy Markdown
Member Author

The test failure is just an environment issue and not something related to my change.

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.

Copilot review overview

🟡 Changes recommended

Nomination progress is not tracked correctly, and initial nomination timeouts use the wrong telemetry classification.

Get a fresh assessment by requesting another Copilot review.

Review tier: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Coordinates the first Visual Studio on-build restore with solution loading and project nomination readiness.

Changes:

  • Adds readiness waiting with timeout and progress tracking.
  • Refactors project readiness checks and telemetry.
  • Adds tests for readiness, timeout, and progress scenarios.
File Summary
test/​NuGet.Clients.Tests/​NuGet.SolutionRestoreManager.Test/​SolutionRestoreWorkerTests.cs Tests readiness, timeout, and progress behavior.
src/​NuGet.Clients/​NuGet.SolutionRestoreManager/​SolutionRestoreWorker.cs Implements on-build readiness coordination and telemetry.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@donnie-msft donnie-msft 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.

Looks good, just a few questions.

@donnie-msft donnie-msft 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.

Ready to approve after I make sure I understand the projects ready check and WaitForOnBuildRestoreReadinessAsync steps.

Otherwise just nits

Wait for initial project nominations without also waiting for pending restore-info source updates. Report nomination-specific telemetry and update focused tests.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: ded16a50-7fb7-4370-8f65-6814854fc818
Keep the project readiness coordination at its only call site and remove the tuple-returning helper.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: ded16a50-7fb7-4370-8f65-6814854fc818
@nkolev92
nkolev92 merged commit e1560f3 into dev Sep 17, 2026
18 checks passed
@nkolev92
nkolev92 deleted the dev-nikolev-buildRestoreCoordination branch September 17, 2026 18:19
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.

Visual Studio: NuGet restore fails if solution build happens too soon after solution open

4 participants