Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 8, 2025

Global SDK installation failed when using single-digit versions (e.g., "7", "8", "9") because getMajorMinor() was called on unresolved versions before they could be expanded to full semver format.

Root Cause

In dotnet.acquireGlobalSDK, the existing install check ran before version resolution:

// Version "7" not yet resolved
const existingOfflinePath = await getExistingInstallOffline(worker, workerContext);

// Resolution happens here - too late
const globalInstallerResolver = new GlobalInstallerResolver(workerContext, commandContext.version);
fullyResolvedVersion = await globalInstallerResolver.getFullySpecifiedVersion(); // "7" → "7.0.410"
commandContext.version = fullyResolvedVersion;

The check internally called getMajorMinor("7") which expects at least two parts and threw: "The requested version 7 is invalid"

Changes

  • vscode-dotnet-runtime-extension/src/extension.ts: Moved getExistingInstallOffline() call after version resolution to ensure all version operations work with fully-resolved semver
  • test/functional/DotnetCoreAcquisitionExtension.test.ts: Added test coverage for single-digit version installation

This preserves the existing install check while ensuring the version format is valid for all downstream operations.

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:

  • microsoft.com
    • Triggering command: node /home/REDACTED/work/vscode-dotnet-runtime/vscode-dotnet-runtime/vscode-dotnet-runtime-library/node_modules/.bin/mocha -u tdd -- dist/test/unit/DebianDistroTests.test.js dist/test/unit/DotnetConditionValidator.test.js dist/test/unit/DotnetCoreAcquisitionWorker.test.js dist/test/unit/DotnetPathFinder.test.js dist/test/unit/DotnetResolver.test.js dist/test/unit/ErrorHandler.test.js dist/test/unit/ExecutableArchitectureDetector.test.js dist/test/unit/ExistingPathResolver.test.js dist/test/unit/GlobalInstallerResolver.test.js dist/test/unit/InstallScriptAcquisitionWorker.test.js dist/test/unit/InstallTracker.test.js dist/test/unit/InstallationValidator.test.js dist/test/unit/IssueReporter.test.js dist/test/unit/JsonInstaller.test.js dist/test/unit/LinuxDistroTests.test.js dist/test/unit/LinuxVersionResolver.test.js dist/test/unit/LocalInstallUpdateService.test.js dist/test/unit/LocalMemoryCacheSingleton.test.js dist/test/unit/LoggingObserver.test.js dist/test/unit/NodeIPCMutex.test.js dist/test/unit/OutputChannelObserver.test.js dist/test/unit/RedHatDistroTests.test.js dist/test/unit/RegistryReader.test.js dist/test/unit/SerializationHelpers.test.js dist/test/unit/VersionResolver.test.js dist/test/unit/VersionUtilities.test.js dist/test/unit/WebRequestWorker.test.js dist/test/unit/WinMacGlobalInstaller.test.js Global Installer Resolver (dns block)
    • Triggering command: node /home/REDACTED/work/vscode-dotnet-runtime/vscode-dotnet-runtime/vscode-dotnet-runtime-library/node_modules/.bin/mocha -u tdd -- dist/test/unit/DebianDistroTests.test.js dist/test/unit/DotnetConditionValidator.test.js dist/test/unit/DotnetCoreAcquisitionWorker.test.js dist/test/unit/DotnetPathFinder.test.js dist/test/unit/DotnetResolver.test.js dist/test/unit/ErrorHandler.test.js dist/test/unit/ExecutableArchitectureDetector.test.js dist/test/unit/ExistingPathResolver.test.js dist/test/unit/GlobalInstallerResolver.test.js dist/test/unit/InstallScriptAcquisitionWorker.test.js dist/test/unit/InstallTracker.test.js dist/test/unit/InstallationValidator.test.js dist/test/unit/IssueReporter.test.js dist/test/unit/JsonInstaller.test.js dist/test/unit/LinuxDistroTests.test.js dist/test/unit/LinuxVersionResolver.test.js dist/test/unit/LocalInstallUpdateService.test.js dist/test/unit/LocalMemoryCacheSingleton.test.js dist/test/unit/LoggingObserver.test.js dist/test/unit/NodeIPCMutex.test.js dist/test/unit/OutputChannelObserver.test.js dist/test/unit/RedHatDistroTests.test.js dist/test/unit/RegistryReader.test.js dist/test/unit/SerializationHelpers.test.js dist/test/unit/VersionResolver.test.js dist/test/unit/VersionUtilities.test.js dist/test/unit/WebRequestWorker.test.js dist/test/unit/WinMacGlobalInstaller.test.js Version Utilities|Global Installer Resolver (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[NETE2ESDK] An error occurred when using a single number version to install SDK.</issue_title>
<issue_description>### Describe the bug.

When we install the SDK with a single number version, an error occureed.
Image

Please attach log file(s) here if you have any.

The log file location should be copied to your clipboard if you came from VS Code.

logs.zip

Reproduction Steps

1.Run command Sample: Install .NET SDK Globally via .NET Install Tool (Former Runtime Extension) or .NET Install Tool - Install the .NET SDK System-Wide and then input SDK version number like 7, 8, 9.

Expected Behavior

It will install the latest SDK version.

Exceptions & Errors (if any)

The SDK cannot be installed as an error occurred.

.NET Install Tool Version

2.4.1

Your operating system? Please provide more detail, such as the version and or distro above.

N/A

VS Code Version

1.150.1</issue_description>

<agent_instructions>It looks like we arent resolving the version correctly - we added an if statement trying to skip the resolving of the version if it was fully specified but it might be wrong sometimes. </agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 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.

- Move getExistingInstallOffline call after version resolution
- Add test case for single-digit version (e.g., "7", "8", "9")
- Ensures version is fully resolved before getMajorMinor is called

Co-authored-by: nagilson <[email protected]>
Copilot AI changed the title [WIP] Fix error during SDK installation with single number version Fix version resolution order for global SDK installation with single-digit versions Nov 8, 2025
Copilot AI requested a review from nagilson November 8, 2025 00:40
Copilot finished work on behalf of nagilson November 8, 2025 00:40
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.

[NETE2ESDK] An error occurred when using a single number version to install SDK.

2 participants