Skip to content

Replace project adapter on PC to PR migration - #7506

Merged
zivkan merged 1 commit into
devfrom
dev-zivkan-fix-12397-atomic-cache-swap
Jun 26, 2026
Merged

zivkan merged 1 commit into
devfrom
dev-zivkan-fix-12397-atomic-cache-swap

Conversation

@zivkan

@zivkan zivkan commented Jun 24, 2026 •

Copy link
Copy Markdown
Member

Bug

Fixes: NuGet/Home#12397

Description

I used to be able to reproduce the bug, when installing the first package in a legacy csproj, and choosing PackageReference as a reference format. Internally this did a packages.config project adapter migration to a PackageReference project adapter.

I'm no longer able to reproduce the bug, but the existing code removes NuGet's project adapter from the cache, then creates the new one and adds it to the cache, all in async code. If PM UI, while on another thread, tries to refresh in the time between removing the old adapter and adding the new, then PM UI will get an error.

But the project adapter cache's add method will replace an adapter if it already exists. So, we can do this to avoid timing issues.

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. N/A

@zivkan
zivkan requested a review from a team as a code owner June 24, 2026 04:26
@zivkan
zivkan requested review from donnie-msft and martinrrm June 24, 2026 04:26
@zivkan
zivkan merged commit ba53358 into dev Jun 26, 2026
20 of 21 checks passed
@zivkan
zivkan deleted the dev-zivkan-fix-12397-atomic-cache-swap branch June 26, 2026 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants