Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error when opening C# project on an Apple Silicon M1 machine without Rosetta #4605

Closed
miguellira opened this issue Jun 11, 2021 · 10 comments
Labels

Comments

@miguellira
Copy link

Issue Description

During the start of the OmniSharp server a call using the built-in mono command returns a Bad CPU type in executable error.

Steps to Reproduce

On a new Apple Silicon M1 machine:

  1. Download and install the Mac Universal version of Visual Studio Code
  2. Download and install the preview version of .NET 6 (6.0.100-preview.4.21255.9)
  3. Create a new C# console project dotnet new console -n ConsoleApp
  4. Open ConsoleApp folder in Visual Studio Code

Expected Behavior

Project loads and C# language features (e.g. code completion) are available.

Actual Behavior

An error is returned in the OmniSharp log and C# features are unavailable.

Logs

OmniSharp log

Starting OmniSharp server at 6/11/2021, 7:28:11 AM Target: /Users/miguellira/Developer/ConsoleApp

OmniSharp server started.
Path: /Users/miguellira/.vscode/extensions/ms-dotnettools.csharp-1.23.12/.omnisharp/1.37.10/run
PID: 10636

/Users/miguellira/.vscode/extensions/ms-dotnettools.csharp-1.23.12/.omnisharp/1.37.10/run: line 27: /Users/miguellira/.vscode/extensions/ms-dotnettools.csharp-1.23.12/.omnisharp/1.37.10/bin/mono: Bad CPU type in executable
[ERROR] Error: OmniSharp server load timed out. Use the 'omnisharp.projectLoadTimeout' setting to override the default delay (one minute).

C# log

Installing C# dependencies... Platform: darwin, arm64

Downloading package 'OmniSharp for OSX' (37658 KB).................... Done!
Validating download...
Integrity Check succeeded.
Installing package 'OmniSharp for OSX'

Downloading package '.NET Core Debugger (macOS / x64)' (45875 KB).................... Done!
Validating download...
Integrity Check succeeded.
Installing package '.NET Core Debugger (macOS / x64)'

Downloading package '.NET Core Debugger (macOS / arm64)' (47834 KB).................... Done!
Validating download...
Integrity Check succeeded.
Installing package '.NET Core Debugger (macOS / arm64)'

Downloading package 'Razor Language Server (macOS / x64)' (60206 KB).................... Done!
Installing package 'Razor Language Server (macOS / x64)'

Finished

[WARNING]: arm64 macOS is not officially supported by the .NET Core debugger. You may experience unexpected issues when running in this configuration.

Environment information

VSCode version: 1.57.0
C# Extension: 1.23.12

Mono Information OmniSharp using built-in mono
Dotnet Information .NET SDK (reflecting any global.json): Version: 6.0.100-preview.4.21255.9 Commit: 950e4949a7

Runtime Environment:
OS Name: Mac OS X
OS Version: 11.4
OS Platform: Darwin
RID: osx.11.0-arm64
Base Path: /usr/local/share/dotnet/sdk/6.0.100-preview.4.21255.9/

Host (useful for support):
Version: 6.0.0-preview.4.21253.7
Commit: bfd6048a60

.NET SDKs installed:
6.0.100-preview.4.21255.9 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.0-preview.4.21253.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.0-preview.4.21253.7 [/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.23.12
@filipw
Copy link
Contributor

filipw commented Jun 11, 2021

This is interesting, I have been using OmniSharp on an M1 mac since December without any issues.
There is no ARM64 built of Omnisharp but it works fine with Rosetta. Looks like for some reason Rosetta does not kick in here.

Do you have Rosetta installed?

softwareupdate --install-rosetta

@miguellira
Copy link
Author

Thanks for the quick follow up @filipw. I think your post cleared things up for me. I have not installed Rosetta on this machine. Looks like VSCode doesn't require it but the C# extension does. Specifically OmniSharp's reliance on mono.

@gregg-miskelly gregg-miskelly changed the title Bad CPU type in executable when opening a C# project on an Apple Silicon M1 machine Improve error when opening C# project on an Apple Silicon M1 machine without Rosetta Jun 11, 2021
@miguellira
Copy link
Author

@gregg-miskelly Thanks for updating this issue and pinning it to the announcement.

I have a question... Now that both Visual Studio Code and the latest preview of .NET 6 SDK no longer requires Rosetta will there be an effort to have the C# plugin follow suit? I didn't find an issue to track, should I create one? Thanks!

@filipw
Copy link
Contributor

filipw commented Jun 14, 2021

OmniSharp has a feature branch for .NET 5.0 which will ultimately become .NET 6.0. At that point we can think of providing native builds for Mac ARM64.

With regards to Rosetta, macOS prompts its installation automatically for GUI programs, but not for console applications/utilities, which is why it was not obvious.

@Tarun047
Copy link

Any updates to this issue ?

@ArquitetoMovel
Copy link

I won't install rosetta compatibility. I will waiting for a native solution for m1. I also waiting for VS for Mac in m1. I hope that Microsoft be fast with this releases.

@filipw
Copy link
Contributor

filipw commented Dec 31, 2021

There is a native prerelease already here https://github.com/OmniSharp/omnisharp-vscode/releases/tag/v1.24.0-beta1
You need to install it and set omnisharp.useModernNet to true

@ArquitetoMovel
Copy link

after install the arm version, it's been also solved the problem that holding dotnet process with 100% CPU without use.

@sercandumansiz
Copy link

sercandumansiz commented Apr 14, 2022

I've just faced with this issue (Bad CPU type) also on v1.24.4 C# Extension(omnisharp.useModernNet: true) and .net 6 on m1(without Rosetta) then I downgraded to v1.24.3 and Omnisharp installed correctly problem solved. I also upgraded to v1.24.4 again and working fine right now. Maybe it's good to check v1.24.4 also.

@filipw
Copy link
Contributor

filipw commented Apr 14, 2022

since we have a native build now, closing this issue

@filipw filipw closed this as completed Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants