Repository navigation
Update the PM UI when a successful restore finishes - #7209
Merged
Merged
Conversation
nkolev92
reviewed
Mar 12, 2026
jebriede
reviewed
Mar 17, 2026
jebriede
left a comment
Contributor
There was a problem hiding this comment.
@martinrrm it looks like you're going to explore refreshing when a project has been updated instead of when the restore completes. Please request rereviews and update the PR description when that's ready. Thanks!
Use _projectUpdateOccurredDuringRestore flag to track whether any project had a non-no-op restore. Solution-level PM UI only refreshes in OnSolutionRestoreFinished if the flag is set, avoiding unnecessary refreshes when the entire restore was a no-op. Also reorder OnProjectUpdateFinished to check Model.IsSolution first, setting the flag for solution-level PM UI before checking visibility. Co-authored-by: Copilot <[email protected]>
martinrrm
force-pushed
the
dev-martinrrm-refresh-pmui-on-restore
branch
from
March 23, 2026 22:01
ad08b79 to
2b6ba07
Compare
Member
|
I think the scenario table is mostly incorrect about the old behavior.
|
nkolev92
reviewed
Apr 1, 2026
nkolev92
approved these changes
Apr 7, 2026
Copilot AI
added a commit
that referenced
this pull request
Apr 16, 2026
This reverts commit 76b3a60. Co-authored-by: jebriede <[email protected]>
2 of 3 tasks
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.
Bug
Fixes: NuGet/Home#14761
Description
This is a proposal fix for NuGet/Home#14761, currently we don't directly watch for files saves, instead we do something like this:
If the file save causes CPS/project system nomination, the path is:
VsSolutionRestoreService4.
AddProjectRestoreInfo(...)updatesProjectSystemCacheCacheUpdatedfiresVSSolutionManager.AfterNuGetCacheUpdatedfiresOnNuGetCacheUpdatedRefresh PM UI on restore completion instead of cache nomination
The Package Manager UI previously refreshed via
AfterNuGetCacheUpdated, which fires during nomination (pre-restore) — meaning the UI would refresh with stale databefore the restore had actually written updated assets files.
This PR replaces that mechanism with
IVsNuGetProjectUpdateEvents, which fires after restore completes and assets files are written:ProjectUpdateFinished— per-project, post-restore signal. Only fires for non-no-op restores (guarded by!isNoOpinRestoreRunner.CommitAsync). Also fires forpackages.config install/uninstall via
PackageProjectEvents.BatchEnd.SolutionRestoreFinished— solution-level, post-restore signal. Used for solution-level PM UI, but only triggers a refresh if at least oneProjectUpdateFinishedfired during that restore cycle (skips full no-op restores).
Key changes
PackageManagerControl.xaml.csAfterNuGetCacheUpdatedsubscription withIVsNuGetProjectUpdateEvents.ProjectUpdateFinishedandSolutionRestoreFinishedPackageManagerControl.xaml.cs_projectUpdateOccurredDuringRestoreflag so solution-level PM UI skips refresh on full no-op restoresPackageManagerControl.xaml.cs_isRefreshRequired = trueand refresh on nextLoadedeventPackageManagerUIRefreshEvent.csRestoreCompletedtoRefreshOperationSourcetelemetry enumVsRestoreProgressEventsTests.csEndProjectUpdateandEndSolutionRestoreNuGetTelemetryServiceTests.csRestoreCompleted(Success, NoOp, NotApplicable)Behavior summary
CacheUpdated)ProjectUpdateFinished)BatchEnd_projectUpdateOccurredDuringRestore_isRefreshRequiredtriggers refresh onLoadedHow it works
OnProjectUpdateFinishedfilters by matchingprojectUniqueNameagainst the viewed project. Refreshes immediately if visible, defers ifhidden.
OnProjectUpdateFinishedsets_projectUpdateOccurredDuringRestore = true.OnSolutionRestoreFinishedchecks this flag — only refreshes ifat least one project had a real restore. This avoids both N-per-project refreshes and unnecessary refreshes on full no-op restores.
_isExecutingActiongates all refresh signals; single refresh happens inExecuteActionfinally block (no double refresh).PR Checklist