dotnet / dotnet/vscode-dotnet-runtime
Spurious errors when used in an offline environment
- Dominant language
- TypeScript
- Stars
- 209
- Forks
- 455
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to use the `ms-dotnettools.csharp` extension to work in an environment that is not connected to the internet, but I can't seem to stop `ms-dotnettools.vscode-dotnet-runtime` from trying to download things.
## Repro case
N.B. My workstation is connected to a network, but not the internet.
I've created a new VSCode profile with only the two relevant extensions installed:
```
> code --profile csharp --list-extensions --show-versions
ms-dotnettools.csharp@2.0.206
ms-dotnettools.vscode-dotnet-runtime@1.6.0
```
I've configured the settings for that profile in a way I _hoped_ would get the installed dotnet versions recognised:
```json
{
"dotnetAcquisitionExtension.existingDotnetPath": [
{"extensionId": "ms-dotnettools.vscode-dotnet-runtime", "path": "C:\\Program Files\\dotnet\\dotnet.exe"},
{"extensionId": "ms-dotnettools.csharp", "path": "C:\\Program Files\\dotnet\\dotnet.exe"},
],
}
```
When I open a folder containing C# files I still get this in ".NET Runtime" output:
```
Error!
Please ensure that you are online: Request to https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/releases-index.json Failed: Error: getaddrinfo ENOTFOUND dotnetcli.blob.core.windows.net
Error!
Please ensure that you are online: Request to https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/releases-index.json Failed: Error: getaddrinfo ENOTFOUND dotnetcli.blob.core.windows.net
Error!
Please ensure that you are online: Request to https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/releases-index.json Failed: Error: getaddrinfo ENOTFOUND dotnetcli.blob.core.windows.net
Error!
Failed to download .NET 7.0:
Please ensure that you are online: Request to https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/releases-index.json Failed: Error: getaddrinfo ENOTFOUND dotnetcli.blob.core.windows.net
Error!
Please ensure that you are online: Request to https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/releases-index.json Failed: Error: getaddrinfo ENOTFOUND dotnetcli.blob.core.windows.net
Downloading the .NET Runtime.
Using configured .NET path: C:\Program Files\dotnet\dotnet.exe
```
I've got various SDKs installed:
```
> dotnet --list-sdks 2.0.0 [C:\Program Files\dotnet\sdk]
2.1.401 [C:\Program Files\dotnet\sdk]
2.2.203 [C:\Program Files\dotnet\sdk]
3.0.100 [C:\Program Files\dotnet\sdk]
3.1.120 [C:\Program Files\dotnet\sdk]
3.1.300 [C:\Program Files\dotnet\sdk]
3.1.302 [C:\Program Files\dotnet\sdk]
3.1.426 [C:\Program Files\dotnet\sdk]
5.0.104 [C:\Program Files\dotnet\sdk]
5.0.408 [C:\Program Files\dotnet\sdk]
6.0.100 [C:\Program Files\dotnet\sdk]
6.0.300 [C:\Program Files\dotnet\sdk]
6.0.400 [C:\Program Files\dotnet\sdk]
7.0.100 [C:\Program Files\dotnet\sdk]
7.0.302 [C:\Program Files\dotnet\sdk]
```
I always get a red "Error acquiring .NET!" message in the status bar, and an error popup:

Is the error message benign? The C# extension appears to be working OK.
If this error is benign:
- Would it be possible to suppress the errors until/unless a runtime/SDK download is actually required?
- Could we have a setting to disable all downloads?
- Could the `existingDotnetPath` setting be made easier to use?
- Maybe take a wildcard for `extensionId`? (I'm struggling to think why you'd typically want this to be a per-extension setting)
- Could it even default to the standard install location?
Thanks.
Contributor guide
Assessment
This issue has not been assessed yet.