-
Notifications
You must be signed in to change notification settings - Fork 684
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
Omnisharp won't start or generate assets in vs code mac m1 #5132
Comments
I see you are using .NET5 x64 SDK, is that intentional? Your M1 should be better off using native arm64 which is available in .NET 6 https://dotnet.microsoft.com/en-us/download/dotnet/6.0 . |
Yeah you are correct, but i am currently working on a .NET 5 application and it won't be upgraded anytime soon. |
@gbubemismith New builds of O# no longer include a minimal Mono and MSBuild (OmniSharp/omnisharp-roslyn#2339). Since you have "omnisharp.path" set to "latest", you are using one of these builds. What version of Mono and MSBuild are installed on your system? $ mono --version
$ msbuild --version |
16.6.0.10801% |
@gbubemismith You will need to install a preview build of Mono with a more recent MSBuild (see https://github.com/OmniSharp/omnisharp-vscode#note-about-using-net-5-sdks=) as your version of Mono does not support .NET 5 development. (Download) The alternative is to set "omnisharp.useModernNet" to true in your VS Code settings. This does require a .NET 6 SDK installation which can be done side-by-side with your .NET 5 SDK. |
Thank you, this resolved my issue. Omnisharp randomly started to stop working for me yesterday, received the same error @gbubemismith was getting. Im using VSCode 1.65.2, macOS Big Sur v11.6.4 |
@amroczeK I imagine you have "omnisharp.path" set to "latest". O# has removed their included Mono and MSBuild 17.x tooling from their nightly builds in favor of using the .NET SDK build of OmniSharp for .NET SDK development. We plan to make "true" the default for "omnisharp.useModernNet". See #5120 for more details. |
FWIW it is generally safe to install a newer SDK and target earlier TFMs from it. For example we use .NET7 x64 SDK to build an app as netcoreapp3.1 for x64, netcoreapp3.1 for x86, net452 for x86, net452 for x64, and netcoreapp2.1 for arm64. Unless your app is a development tool and has ties to the SDK itself, e.g as omnisharp-roslyn that uses various bits and pieces from the SDK. |
Sorry if I am clear you're saying I can have only .NET 6 sdk installed on my machine and still run a .NET 5 or .NET 3.1 application?? |
@gbubemismith Running applications only requires that you have an appropriate .NET runtime installed. You can even publish applications as self-contained apps which do not need a runtime at all. |
I have dotnet 6 SDK installed but the second solution here hasn't worked for me. I am also not receiving any errors from Omnisharp. Not sure if it could be due to the project I am working on using dotnet 5? |
@MarianaK96 Can you please open a new issue and provide your Omnisharp log from the VS Code Output pane as well as the output of |
I just uninstalled .net 5 and restarted Omnisharp. Below is my error: ` Starting OmniSharp server at 4/6/2022, 4:04:20 PM OmniSharp server started with .NET 6.0.101 Unhandled exception. System.BadImageFormatException: Could not load file or assembly '/Users/Igbokwe/.vscode/extensions/ms-dotnettools.csharp-1.24.3-darwin-arm64/.omnisharp/1.38.3-beta.33-net6.0/OmniSharp.dll'. An attempt was made to load a program with an incorrect format. File name: '/Users/Igbokwe/.vscode/extensions/ms-dotnettools.csharp-1.24.3-darwin-arm64/.omnisharp/1.38.3-beta.33-net6.0/OmniSharp.dll' |
@UcheIgbokwe Looks like you have the x64 build of the .NET 6 sdk installed on a M1 Mac. If you install the arm64 build, this should fix your issue. |
@JoeRobich Just switched to the arm64 build and it works fine on vscode. |
@JoeRobich is there a way I can make my cli point to .net 6 path? My cli always points to the x64 path no matter the order in which I install. Never mind I have sorted it out |
Just in case some one else has this problem in Mac M1 Monterrey: |
Environment data
dotnet --info
output:.NET SDK (reflecting any global.json):
Version: 5.0.405
Commit: 63325e1c7d
Runtime Environment:
OS Name: Mac OS X
OS Version: 12.2
OS Platform: Darwin
RID: osx-x64
Base Path: /usr/local/share/dotnet/x64/sdk/5.0.405/
Host (useful for support):
Version: 5.0.14
Commit: d5b56c6327
.NET SDKs installed:
3.1.416 [/usr/local/share/dotnet/x64/sdk]
5.0.405 [/usr/local/share/dotnet/x64/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.22 [/usr/local/share/dotnet/x64/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.14 [/usr/local/share/dotnet/x64/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.22 [/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.14 [/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
VS Code version: 1.65.2
C# Extension version: v1.3.1
OmniSharp log
Starting OmniSharp server at 3/29/2022, 12:21:47 PM
Target: /Users/gbubemismith/Documents/coreApps/HardCore
OmniSharp server started.
Path: /Users/gbubemismith/.vscode/extensions/ms-dotnettools.csharp-1.24.1/.omnisharp/1.38.3-beta.31/run
PID: 12046
System.TypeInitializationException: The type initializer for 'System.ComponentModel.TypeDescriptor' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Sys' threw an exception. ---> System.DllNotFoundException: System.Native assembly: type: member:(null)
b__1 () [0x00000] in <4061e52126604f67b6d455853ab7baf7>:0at (wrapper managed-to-native) Interop+Sys.LChflagsCanSetHiddenFlag()
at Interop+Sys..cctor () [0x00000] in <36514b14425c4337b446653c547aa9c3>:0
--- End of inner exception stack trace ---
at Interop.GetRandomBytes (System.Byte* buffer, System.Int32 length) [0x00000] in <36514b14425c4337b446653c547aa9c3>:0
at System.Guid.NewGuid () [0x00000] in <36514b14425c4337b446653c547aa9c3>:0
at System.ComponentModel.TypeDescriptor..cctor () [0x00034] in <4f55bbf82f9b4c60960312888c59bd5c>:0
--- End of inner exception stack trace ---
at OmniSharp.Internal.CommandOptionExtensions.GetValueOrDefault[T] (McMaster.Extensions.CommandLineUtils.CommandOption opt, T defaultValue) [0x00008] in :0
at OmniSharp.Stdio.StdioCommandLineApplication.get_Encoding () [0x00000] in :0
at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_1.
at OmniSharp.CommandLineApplication+<>c__DisplayClass12_0.b__0 () [0x0000b] in :0
at McMaster.Extensions.CommandLineUtils.CommandLineApplication+<>c__DisplayClass146_0.b__0 (System.Threading.CancellationToken _) [0x00000] in :0
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync (System.String[] args, System.Threading.CancellationToken cancellationToken) [0x000bf] in :0
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x00016] in :0
at OmniSharp.CommandLineApplication.Execute (System.String[] args) [0x00081] in :0
at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_0.b__0 () [0x00028] in <4061e52126604f67b6d455853ab7baf7>:0
at OmniSharp.HostHelpers.Start (System.Func`1[TResult] action) [0x0001c] in :0
Steps to reproduce
Try generating .net assets for build and debug
Expected behavior
.vscode is created and I cand run and debug my .net application
Actual behavior
I get System.TypeInitializationException: The type initializer for 'System.ComponentModel.TypeDescriptor' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Sys' threw an exception. ---> System.DllNotFoundException: System.Native assembly: type: member:(null)
The text was updated successfully, but these errors were encountered: