Skip to content

Fix nomination hang during project rename#7435

Draft
nkolev92 wants to merge 2 commits into
devfrom
dev-nkolev92-fixNominationHang
Draft

Fix nomination hang during project rename#7435
nkolev92 wants to merge 2 commits into
devfrom
dev-nkolev92-fixNominationHang

Conversation

@nkolev92
Copy link
Copy Markdown
Member

Bug

Fixes: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1618509

Description

A project rename in Visual Studio causes a permanent hang because NuGet's ProjectSystemCache loses a project's ProjectRestoreInfo during the rename, and no recovery path exists. The SolutionRestoreWorker drain loop polls indefinitely at 400ms intervals because IsAllProjectsNominatedAsync() can never return true again.

Changes

  1. Timeout in the !isAllProjectsNominated branch (SolutionRestoreWorker.cs): If no nominations arrive within BulkRestoreCoordinationTimeout (5 minutes) since the last received nomination, break the drain loop and proceed with restore. This prevents permanent hangs when a project's cache entry is wiped and no recovery nomination can arrive. Uses the existing ImplicitRestoreReason.NominationsIdleTimeout telemetry reason.

  2. Preserve ProjectRestoreInfoSource across renames (VSSolutionManager.cs, ProjectSystemCache.cs, IProjectSystemCache.cs): Before removing a project from the cache during rename, retrieve its ProjectRestoreInfoSource and re-register it on the new cache entry. This ensures future restore cycles can properly coordinate via HasPendingNomination. Added TryGetProjectRestoreInfoSource to IProjectSystemCache.

PR Checklist

  • PR has a meaningful title
  • PR has a linked work item
  • Tested changes locally

nkolev92 and others added 2 commits May 29, 2026 18:53
Add timeout to the !isAllProjectsNominated branch in the restore drain
loop. If no nominations arrive within BulkRestoreCoordinationTimeout
(5 minutes), break and proceed with restore using available data.
This prevents permanent hangs when a project's cache entry is wiped
and no recovery nomination can arrive.

Preserve ProjectRestoreInfoSource across project renames so that
future restore cycles can properly coordinate via HasPendingNomination.
Previously, OnEnvDTEProjectRenamed destroyed the entire cache entry
including the source registration, which was never re-registered.

Fixes: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1618509

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant