question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
filipwcommented, 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

1reaction
filipwcommented, 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
Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't build to simulator on Apple Silicon
1) I've tried "pod install" & "pod update" with a Rosetta2 version of Terminal. Both complete without error, but Xcode still can't build....
Read more >
Xcode error 'building for iOS Simulator, but linking in dylib built ...
As mentioned above, a better solution is to setup your project to force the simulator to run as x86 and not all of...
Read more >
Visual Studio 2022 for Mac v17.5 Preview - Release Notes
Get information on the latest release features, bug fixes, and support for Visual Studio 2022 for Mac v17.5 Preview. Download today.
Read more >
Apple Silicon (M1 / M2) Compatibility News - Native Instruments
The products that are natively compatible with Apple Silicon do not require Rosetta. Apple Silicon Compatibility Status of NI Products. The below table...
Read more >
How to set up an M1 MacBook for web development
But until then, most of the tools should be transitioned to Apple Silicon as well. Keep in mind that Rosetta is not installed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found