Fix SDK version sorting to prioritize 10.0.100#420
Conversation
|
@copilot please try again |
…omparison Changed VisualStudioSafeVersionsExtractor.GetReasonRequiredStrings to sort by Bundle object (which uses semantic version comparison) instead of DisplayName string. This fixes the issue where version 10.0.100 was incorrectly sorted before 2.x, 5.x, etc. due to lexicographic string ordering where "1" < "2". Co-authored-by: marcpopMSFT <[email protected]>
Fixed the SDK version sorting issue in commit 56a066f. The problem was that the code was sorting bundles by DisplayName (string) instead of by the Bundle object (which uses semantic version comparison). This caused version 10.0.100 to be incorrectly sorted before versions like 2.x, 5.x, 9.x due to lexicographic ordering where "1" < "2". Now it correctly sorts by version number. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: marcpopMSFT <[email protected]>
Co-authored-by: marcpopMSFT <[email protected]>
|
Before: After: |
|
ping @NikolaMilosavljevic for review. |
|
This issue was fixed on Windows, but still reproduced on Mac. @marcpopMSFT could you help to take a look? |
I'll take a look. |
|
@NicoleWang001 - I was not able to reproduce this issue on Mac. .NET versions were listed in correct order. |
|
Hi @NikolaMilosavljevic ,We rechecked and confirmed that the .NET versions are listed correctly. It seems we may have used an incorrect build earlier—apologies for the confusion. |





Fixed SDK version sorting issue in
VisualStudioSafeVersionsExtractor.GetReasonRequiredStrings()method. The problem was that versions were being sorted lexicographically by their DisplayName string, causing version 10.0.100 to sort incorrectly (appearing after 9.x but before 2.x in descending order).Changes Made
Changed line 130 in
src/dotnet-core-uninstall/Shared/VSVersioning/VisualStudioSafeVersionsExtractor.csto sort by the Bundle object itself (which implements IComparable using semantic version comparison) instead of by DisplayName string:Result
Version 10.0.100 now correctly sorts numerically with other versions (12.x > 11.x > 10.x > 9.x > ... > 1.x) instead of using lexicographic string ordering where "10" would incorrectly appear between "1" and "2".
Testing
The change is minimal and surgical, affecting only one line to fix the version comparison logic.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.