vscode-csharp: System.BadImageFormatException starting omnisharp server (osx-arm64)
Issue Description
Steps to Reproduce
- Install prerelease 1.24.0 from VSIX to VS Code.
- Observe output. Extension installs but Omnisharp server fails to start. Output:
Starting OmniSharp server at 1/15/2022, 4:01:18 PM
Target: /Users/eck/Code/my-project
OmniSharp server started with .NET 6.0.100
.
Path: /Users/eck/.vscode/extensions/ms-dotnettools.csharp-1.24.0/.omnisharp/1.38.1-beta.15-net6.0/OmniSharp.dll
PID: 64647
Unhandled exception. System.BadImageFormatException: An attempt was made to load a program with an incorrect format.
(0x8007000B)
[ERROR] Error: OmniSharp server load timed out. Use the 'omnisharp.projectLoadTimeout' setting to override the default delay (one minute).
Expected Behavior
Omnisharp server starts.
Actual Behavior
Omnisharp server does not start.
Logs
OmniSharp log
Post the output from Output-->OmniSharp log here
C# log
Post the output from Output-->C# here
Environment information
VSCode version: 1.63.2 C# Extension: 1.24.0
Mono Information
OmniSharp using built-in monoDotnet Information
.NET SDK (reflecting any global.json): Version: 6.0.100 Commit: 9e8b04bbffRuntime Environment: OS Name: Mac OS X OS Version: 12.0 OS Platform: Darwin RID: osx-arm64 Base Path: /usr/local/share/dotnet/sdk/6.0.100/
Host (useful for support): Version: 6.0.0 Commit: 4822e3c3aa
.NET SDKs installed: 6.0.100 [/usr/local/share/dotnet/sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions
Extension | Author | Version |
---|---|---|
csharp | ms-dotnettools | 1.24.0 |
docomment | k–kato | 0.1.30 |
githistory | donjayamanne | 0.6.19 |
markdown-image-size | bierner | 0.0.4 |
remote-containers | ms-vscode-remote | 0.209.6 |
remote-ssh | ms-vscode-remote | 0.70.0 |
remote-ssh-edit | ms-vscode-remote | 0.70.0 |
sort-js-object-keys | zengxingxin | 1.0.6 |
terraform | hashicorp | 2.18.0 |
vscode-docker | ms-azuretools | 1.18.0 |
vscode-kubernetes-tools | ms-kubernetes-tools | 1.3.6 |
vscode-markdownlint | DavidAnson | 0.45.0 |
vscode-sort | henriiik | 0.2.5 |
vscode-yaml | redhat | 1.3.0 |
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 26 (8 by maintainers)
For me (on an M1 MacBook), the problem was that I had mistakenly installed the x64
dotnet
instead of the Arm64 one. The fix was to:dotnet
:dotnet
(Arm64 version), (https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-6.0.402-macos-arm64-installer)That was absolutely 100% and right!
Had the same issue … and when installing the C# extension of vsCode it always downloaded the x64 version despite me having installed the arm64 dotnet version and deleted the x64 version.
Check if you have the old intel vscode version installed
It said Intel here for me first so thats why he downloaded the x64 omisharp tools after updating to the “apple branch” of vscode it said apple there and it downloaded the correct arm64 version of it.
hope this helps!
It helped with the following steps. If like me, you have transferred from an older mbp to m1s…
~/.vscode/extensions/ms-dotnettools.csharp-1.25.0-darwin-x86
~/.vscode/extensions/ms-dotnettools.csharp-1.25.0-darwin-arm64
or another arm64 based extension is downloaded and installed.I have the same error here. Without useModernNet Omnisharp loads but with the option enabled I receive the above error.
@spotnick @nilzzzzzz Do you have the x64 or the arm64 build of the SDK installed? Both will run on a arm64 Mac but you will need to use the arm64 build with the C# extension.