Skip to content

dotnet.acquire can return stale runtime when offline check fails in mssql extension #2666

Description

@aasimkhan30

Describe the bug.

Hello everyone, I’m a contributor to the MSSQL extension. We recently switched the extension to use the .NET Install Tool to acquire the runtime needed to start our C# out-of-proc service, which provides connection, language service, and other MSSQL functionality.

There seems to be a bug in this extension.

Example request:

await vscode.commands.executeCommand("dotnet.acquire", {
  version: "10.0.7",
  requestingExtensionId: "ms-mssql.mssql",
  mode: "runtime",
  forceUpdate: true
});

Expected Behavior

  • Return 10.0.7, or
  • Return a compatible same-major/minor runtime with patch >= 10.0.7, or
  • Fail acquisition if no compatible runtime exists and download is unavailable.

Actual Behavior

  • In the offline fallback path, getSimilarExistingInstall() appears to match only major.minor.
  • That means a cached runtime such as 10.0.3 can be returned for a 10.0.7 request.
  • Our extension then launches the outerproc whose runtimeconfig.json requires Microsoft.NETCore.App 10.0.7, and the launch fails.

We also saw logs where the tool reported:

It looks like you may be offline (can you connect to www.microsoft.com?)

but then successfully downloaded 10.0.7~x64. So the offline warning may be a false positive if the probe to www.microsoft.com fails while the download endpoint is reachable.

One of our users is facing this issue: microsoft/vscode-mssql#22015 (comment)

While I’ve temporarily managed to unblock affected users, I expect this issue to persist whenever we update our out-of-process service and it requires a newer .NET runtime runtime. A good chunk of our users run this extension in air-gapped/firewalled environment so it is important we find some workaround.

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

It looks like you may be offline (can you connect to www.microsoft.com?) and have no compatible installations of .NET 10.0.7 for ms-mssql.mssql.
Installation will timeout in 600 seconds.
ms-mssql.mssql requested to download the .NET Runtime.
Downloading .NET version(s) 10.0.7~x64 ....................... Done!
.NET 10.0.7~x64 executable path: c:\Users\AhmedTarek\AppData\Roaming\Code - Insiders\User\globalStorage\ms-dotnettools.vscode-dotnet-runtime\.dotnet\10.0.7~x64\dotnet.exe

.NET Install Tool Version

3.0.0

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

Windows (Should happen on every OS though)

VS Code Version

1.117.0

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions