Fix latest/preview SDK garbage collection#53871
Merged
nagilson merged 1 commit intodotnet:release/dnupfrom Apr 15, 2026
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
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 keepingpreviewsemantics intact. - Add direct unit coverage for
UpdateChannel.Matches. - Add a garbage collection regression test ensuring stable + preview SDK installations are preserved when both
latestandpreviewspecs 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. |
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.
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