Failed to download omnisharp binary and start omnisharp process
Issue Description
Steps to Reproduce
- install C# extension
- set
omnisharp.useModernNet=trueanddotnet.server.useOmnisharp=truein vscode's settings.json - create new csharp project with
dotnet new console - open directory with vscode
Expected Behavior
omnisharp will be downloaded from internet and start omnisharp process.
Actual Behavior
omnisharp downloading is failed and cannot start omnisharp process
Logs
OmniSharp log
[STDERR] Could not execute because the specified command or file was not found.
C# log
2025-02-06 02:56:42.555 [info] Downloading package 'Razor Language Server for OmniSharp (Linux / x64)'
2025-02-06 02:56:42.555 [info] Failed at stage: downloadPackage
2025-02-06 02:56:42.555 [info] TypeError: Cannot read properties of undefined (reading 'HttpsProxyAgent')
Environment information
VSCode version: 1.96.4 C# Extension: 2.63.32 Using OmniSharp: true
Mono Information
Unable to find Mono. Ensure that Mono's '/bin' folder is added to your environment's PATH variable.Dotnet Information
.NET SDK: Version: 8.0.404 Commit: 7b190310f2 Workload version: 8.0.400-manifests.7ab0bf57 MSBuild version: 17.11.9+a69bbaaf5Runtime Environment: OS Name: ubuntu OS Version: 24.04 OS Platform: Linux RID: ubuntu.24.04-x64 Base Path: /usr/lib/dotnet/sdk/8.0.404/
.NET workloads installed: Configured to use loose manifests when installing new manifests. There are no installed workloads to display.
Host: Version: 8.0.12 Architecture: x64 Commit: 89ef51c5d8
.NET SDKs installed: 6.0.428 [/usr/lib/dotnet/sdk] 8.0.112 [/usr/lib/dotnet/sdk] 8.0.404 [/usr/lib/dotnet/sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 6.0.36 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.8 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.11 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.12 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.36 [/usr/lib/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.8 [/usr/lib/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.11 [/usr/lib/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.12 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
Other architectures found: None
Environment variables: Not set
global.json file: Not found
Learn more: https://aka.ms/dotnet/info
Download .NET: https://aka.ms/dotnet/download
Visual Studio Code Extensions
| Extension | Author | Version | Folder Name |
|---|---|---|---|
| csharp | ms-dotnettools | 2.63.32 | ms-dotnettools.csharp-2.63.32-linux-x64 |
| csharp-ls | vytautassurvila | 0.0.24 | vytautassurvila.csharp-ls-0.0.24 |
| terraform | hashicorp | 2.34.3 | hashicorp.terraform-2.34.3-linux-x64 |
| vscode-dotnet-runtime | ms-dotnettools | 2.2.6 | ms-dotnettools.vscode-dotnet-runtime-2.2.6 |
Additional Info
My network is behind http proxy(squid)
Starting OmniSharp server at 2/11/2025, 9:36:24 AM
Target: c:\vscode_Development\GrobODA\GrobODA.sln
OmniSharp server started with .NET 9.0.102
.
Path: c:\Users\zindathmi\.vscode\extensions\ms-dotnettools.csharp-2.63.32-win32-x64\.omnisharp\1.39.12-net6.0\OmniSharp.dll
PID: 17872
[STDERR] Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET program, but dotnet-c:\Users\zindathmi\.vscode\extensions\ms-dotnettools.csharp-2.63.32-win32-x64\.omnisharp\1.39.12-net6.0\OmniSharp.dll does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
[ERROR] Error: OmniSharp server load timed out. Use the 'omnisharp.projectLoadTimeout' setting to override the default delay (one minute).
also broken here
reverting back to version 2.63.28 fixes this problem
Having the same issue!
I'am facing the same issue too
@Andi-Re @ElisabethGerhorst Please share your C# & OmniSharp logs from the output pane so we can get an idea of what went wrong for you.
It looks like there are at least two separate issues here.
-
2025-02-06 02:56:42.555 [info] TypeError: Cannot read properties of undefined (reading 'HttpsProxyAgent')@itn3000 Do you get this error every time your launch VS Code? -
[STDERR] Could not execute because the specified command or file was not found.@hansWurst-creator Did the file c:\Users\zindathmi.vscode\extensions\ms-dotnettools.csharp-2.63.32-win32-x64.omnisharp\1.39.12-net6.0\OmniSharp.dll exist on disk?
[STDERR] Could not execute because the specified command or file was not found.@hansWurst-creator Did the file c:\Users\zindathmi.vscode\extensions\ms-dotnettools.csharp-2.63.32-win32-x64.omnisharp\1.39.12-net6.0\OmniSharp.dll exist on disk?
checking for the current version. File does not exist on disk: c:\Users\zindathmi.vscode\extensions\ms-dotnettools.csharp-2.69.25-win32-x64.omnisharp\1.39.12-net6.0\OmniSharp.dll
@hansWurst-creator Just to be sure. Are you still seeing that same issue with the current version?
here is my "C#" output window(disable C# devkit, "dotnet.server.useOmnisharp" set true) I forgot to report that I use http/https proxy
2025-04-04 09:25:02.340 [info] Installing C# dependencies...
2025-04-04 09:25:02.340 [info]
2025-04-04 09:25:02.340 [info] Platform: win32, x86_64
2025-04-04 09:25:02.340 [info]
2025-04-04 09:25:02.340 [info] Downloading package 'OmniSharp for Windows (.NET 6 / x64)'
2025-04-04 09:25:02.340 [info] Failed at stage: downloadPackage
2025-04-04 09:25:02.340 [info] TypeError: Cannot read properties of undefined (reading 'HttpsProxyAgent')
2025-04-04 09:25:02.340 [info]
2025-04-04 09:25:02.342 [info] Installing Razor OmniSharp Version = 7.0.0-preview.23363.1...
2025-04-04 09:25:02.342 [info]
2025-04-04 09:25:02.342 [info] Platform: win32, x86_64
2025-04-04 09:25:02.343 [info]
2025-04-04 09:25:02.348 [info] Downloading package 'Razor Language Server for OmniSharp (Windows / x64)'
2025-04-04 09:25:02.349 [info] Failed at stage: downloadPackage
2025-04-04 09:25:02.349 [info] TypeError: Cannot read properties of undefined (reading 'HttpsProxyAgent')
2025-04-04 09:25:02.349 [info]
@JoeRobich :
In the C# output window I get exactly the same output as reported by itn3000. It happens everytime I launch VS Code with a workspace containing a .cs file.
In the OmniSharp Log output window I get the same output as reported by hansWurst-creator, but in my case the OmniSharp server started with .NET 8.0.107. The file ...\ms-dotnettools.csharp-2.73.16-win32-x64\.omnisharp\1.39.12-net6.0\OmniSharp.dll can not be found. The 1.39.12-net6.0 folder is completely empty.
@hansWurst-creator Just to be sure. Are you still seeing that same issue with the current version?
some more info: it seems to be the vscocde proxy setting that mess up the install of omnisharp.
How to reproduce: With these Settings set the download of omnisharp fails.
"http.proxySupport": "on", "http.proxy": "http://.........", "http.proxyAuthorization": null, "http.proxyStrictSSL": false,
Disabling them for me leads to a successful download and running omnisharp
Same problem and and there is no way to bypass the proxy. Maybe there is a manual way to install omnisharp?
Partial manual solution (windows example):
- Download next files from
urlproperty in .vscode\extensions\ms-dotnettools.csharp-2.72.34-win32-x64\package.json:- https://roslynomnisharp.blob.core.windows.net/releases/1.39.12/omnisharp-win-x64-net6.0-1.39.12.zip
- https://download.visualstudio.microsoft.com/download/pr/aee63398-023f-48db-bba2-30162c68f0c4/8d42e62ea4051381c219b3e31bc4eced/razorlanguageserver-win-x64-7.0.0-preview.23363.1.zip
- https://vsdebugger-cyg0dxb6czfafzaz.b01.azurefd.net/coreclr-debug-2-66-0/coreclr-debug-win7-x64.zip
- Extract them to path from
installPathproperty - Reload vs code.
Result: language features are working, debugger not working.
Starting OmniSharp server at 2/11/2025, 9:36:24 AM Target: c:\vscode_Development\GrobODA\GrobODA.sln OmniSharp server started with .NET 9.0.102 . Path: c:\Users\zindathmi\.vscode\extensions\ms-dotnettools.csharp-2.63.32-win32-x64\.omnisharp\1.39.12-net6.0\OmniSharp.dll PID: 17872 [STDERR] Could not execute because the specified command or file was not found. Possible reasons for this include: * You misspelled a built-in dotnet command. * You intended to execute a .NET program, but dotnet-c:\Users\zindathmi\.vscode\extensions\ms-dotnettools.csharp-2.63.32-win32-x64\.omnisharp\1.39.12-net6.0\OmniSharp.dll does not exist. * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH. [ERROR] Error: OmniSharp server load timed out. Use the 'omnisharp.projectLoadTimeout' setting to override the default delay (one minute).also broken here
reverting back to version 2.63.28 fixes this problem
I've experienced the same missing OmniSharp error, but it starts where I had been working fine one day then the next I go work offline somewhere and for some reason the minute I open VSCode then the OmniSharp log opens and shows it trying to download something (but I'm offline?), and when I check the .omnisharp folder its missing. Why. This has happened to me multiple times now.
The error was caused by incorrect usage of the http-proxy-agent and https-proxy-agent libraries in src/packageManager/proxy.ts. The code was using a default import and then trying to access the class as a property, which is incorrect. Incorrect Code:
import HttpsProxyAgent from 'https-proxy-agent';
// ...
new HttpsProxyAgent.HttpsProxyAgent(proxyEndpoint, opts);
This failed because HttpsProxyAgent.HttpsProxyAgent was undefined.
Solution The fix was to change the import to a named import and instantiate the class directly, according to the library's documentation. Corrected Code:
import { HttpsProxyAgent, HttpsProxyAgentOptions } from 'https-proxy-agent';
// ...
new HttpsProxyAgent(proxyEndpoint, opts);
This change correctly imports and uses the HttpsProxyAgent class, resolving the TypeError.
@WVVxm Do you intend to open a PR for your change?
@WVVxm Do you intend to open a PR for your change? No. But I hope someone would do it. : )
This issue is resolved with #8457. It will be part of the next release.