Skip to content

Fix latest/preview SDK garbage collection#53871

Merged
nagilson merged 1 commit intodotnet:release/dnupfrom
dsplaisted:fix/dotnetup-latest-preview-gc
Apr 15, 2026
Merged

Fix latest/preview SDK garbage collection#53871
nagilson merged 1 commit intodotnet:release/dnupfrom
dsplaisted:fix/dotnetup-latest-preview-gc

Conversation

@dsplaisted
Copy link
Copy Markdown
Member

Summary

Fix a dotnetup regression where installing latest and then preview could cause the stable SDK to be garbage collected because both install specs collapsed onto the preview install.

Changes

  • make UpdateChannel.Matches("latest") only match stable releases
  • keep preview semantics intact for fallback scenarios
  • add direct UpdateChannel.Matches unit coverage
  • add a garbage collection regression test for latest + preview coexistence

Ensure garbage collection keeps stable SDK installs when both latest and preview channels are tracked, and add direct matcher regression coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 14, 2026 22:23
@dsplaisted dsplaisted requested a review from nagilson April 14, 2026 22:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a dotnetup regression where latest and preview install specs could collapse onto the same (preview) installation during garbage collection, causing the stable SDK to be removed even though it was still referenced.

Changes:

  • Update UpdateChannel.Matches("latest") to only match stable (non-prerelease) versions, while keeping preview semantics intact.
  • Add direct unit coverage for UpdateChannel.Matches.
  • Add a garbage collection regression test ensuring stable + preview SDK installations are preserved when both latest and preview specs exist.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Installer/Microsoft.Dotnet.Installation/Internal/UpdateChannel.cs Refines channel matching so latest and lts require stable releases; preview continues to match stable for fallback scenarios.
test/dotnetup.Tests/UpdateChannelTests.cs Adds focused unit tests validating UpdateChannel.Matches behavior across version patterns and named channels.
test/dotnetup.Tests/GarbageCollectorTests.cs Adds regression coverage for latest + preview spec coexistence to ensure GC keeps both stable and preview installations.

Copy link
Copy Markdown
Member

@nagilson nagilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

@nagilson nagilson enabled auto-merge April 14, 2026 23:07
@nagilson nagilson merged commit 4fe2ae8 into dotnet:release/dnup Apr 15, 2026
18 checks passed
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.

3 participants