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

[MacOS] Cannot start OmniSharp because Mono version >=6.4.0 is required." after upgrade to latest vscode version(1.54.1) #4428

Closed
LoranceChen opened this issue Mar 7, 2021 · 15 comments

Comments

@LoranceChen
Copy link

LoranceChen commented Mar 7, 2021

My Unity3D project c# do not work after auto upgrade vscode 1.54.1 version today.
I have re-install latest mono(6.12) and dotnet core(3.1.4) but not work still. for detail:

  • mono --version
Mono JIT compiler version 6.12.0.122 (2020-02/c621c35ffa0 Wed Feb 10 00:51:43 EST 2021)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	Interpreter:   yes
	LLVM:          yes(610)
	Suspend:       hybrid
	GC:            sgen (concurrent by default)
  • dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.406
 Commit:    f42e6b201a

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/3.1.406/

Host (useful for support):
  Version: 3.1.12
  Commit:  0267ad09c6

.NET Core SDKs installed:
  2.1.4 [/usr/local/share/dotnet/sdk]
  2.1.301 [/usr/local/share/dotnet/sdk]
  3.1.301 [/usr/local/share/dotnet/sdk]
  3.1.406 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.12 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.12 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

other settings:

  1. macos version: 10.12
  2. "omnisharp.useGlobalMono":"always"
  3. "omnisharp.monoPath": "/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono"
  4. .zshrc about mono
export MONO_HOME=/Library/Frameworks/Mono.framework/Versions/Current
export PATH=$PATH:$MONO_HOME/bin:$MONO_HOME/Commands

thanks.

@LoranceChen LoranceChen changed the title [MacOS] Cannot start OmniSharp because Mono version >=6.4.0 is required." with latest vscode version(1.54.1) [MacOS] Cannot start OmniSharp because Mono version >=6.4.0 is required." after upgrade to latest vscode version(1.54.1) Mar 7, 2021
@filipw
Copy link
Contributor

filipw commented Mar 7, 2021

this suggests that msbuild is missing or out of date in the mono installation.

did you install using the official package from https://www.mono-project.com/download/stable? e.g. homebrew mono is known to be missing msbuild

@LoranceChen
Copy link
Author

@filipw hi, I'm re-install from the official package as you said.
homebrew mono not installed because too slow to install(from china). Should I try install mono from brew cmd?

@LoranceChen
Copy link
Author

just test brew install mono, it's almost not support macos 10.12 now.

Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> Updated Casks
Updated 7 casks.

Warning: You are using macOS 10.12.
We (and Apple) do not provide support for this old version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
old version.

Error: mono: no bottle available!
You can try to install from source with:
  brew install --build-from-source mono
Please note building from source is unsupported. You will encounter build
failures with some formulae. If you experience any issues please create pull
requests instead of asking for help on Homebrew's GitHub, Twitter or any other
official channels.

@filipw
Copy link
Contributor

filipw commented Mar 7, 2021

what does msbuild print? It must be available on your path

@aylanonsense
Copy link

I've been having issues that sound similar to this, posted here: https://stackoverflow.com/questions/66507869/cannot-start-omnisharp-because-mono-version-6-4-0-is-required

@filipw
Copy link
Contributor

filipw commented Mar 7, 2021

if you echo $PATH from inside VS Code (e.g. VS Code terminal) does it have

/Library/Frameworks/Mono.framework/Versions/Current/Commands

in it?

It is a bit unfortunate that the extensions does this check - because the OmniSharp server will also do it, and then print more info if something is missing.

We have seen problems like these happen with brew installations in the past due to missing MSBuild. You should try to get rid of the brew installation, and only use the official installer https://www.mono-project.com/download/stable. Also make sure the above path is in the PATH, instead of /usr/local/bin/mono, and that you restart VS Code. Finally, once that's set up, you can get rid of any "omnisharp.monoPath" settings as well.

@aylanonsense
Copy link

aylanonsense commented Mar 7, 2021

Gotcha. I did brew uninstall monoand got rid of "omnisharp.monoPath". Things look like this now:

  • which mono outputs /Library/Frameworks/Mono.framework/Versions/Current/Commands/mono (in terminal and in VS Code's terminal)
  • mono --version outputs Mono JIT compiler version 6.12.0.122 (in terminal and in VS Code's terminal)
  • echo $PATH contains /Library/Frameworks/Mono.framework/Versions/Current/Commands (in terminal and in VS Code's terminal)
  • VS Code's settings.json has "omnisharp.useGlobalMono": "always" and no other OmniSharp settings

Yet the OmniSharp logs still only say Error: Cannot start OmniSharp because Mono version >=6.4.0 is required. (My other system info can be found in https://stackoverflow.com/questions/66507869/cannot-start-omnisharp-because-mono-version-6-4-0-is-required )

@heshuimu
Copy link

heshuimu commented Mar 8, 2021

I have the same issue starting recently. My copy of mono is installed by Visual Studio for Mac.
Removing monoPath setting did work for me.

@jeffreylanters
Copy link

I'm running into the same problem. I've set both my monoPath to the current mono build (6.12.0.10) and useGlobalMono to always. When running mono in te terminal, everything seems to work fine. But the Error: Cannot start OmniSharp because Mono version >=6.4.0 is required error remained. Removed the monoPath seems to resolve this issue.

@LoranceChen
Copy link
Author

LoranceChen commented Mar 8, 2021

what does msbuild print? It must be available on your path

@filipw only one word print in OminiSharp Log output: [ERROR] Error: Cannot start OmniSharp because Mono version >=6.4.0 is required. not any msbuild mentioned

if you echo $PATH from inside VS Code (e.g. VS Code terminal) does it have

Yes. with echo $PATH | grep Mono in vscode Ternimal, output contains: :/Library/Frameworks/Mono.framework/Versions/Current/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands

@LoranceChen
Copy link
Author

LoranceChen commented Mar 8, 2021

I'm upgrade macOS to latest 11.2.2 and download Visual Studio for Mac temporarily (which swallow 800+M memory :-( .
and others, it works great.

Hopes VS code finally fixed.

@aylanonsense
Copy link

I downgraded to Visual Studio Code 1.52.1 at https://code.visualstudio.com/updates/v1_52 and turned off automatic updates in VS Code and OmniSharp is now working without any exceptions. Seems likely that the root cause lies with VS Code 1.54 (or possibly 1.53)

@JoeRobich
Copy link
Member

JoeRobich commented Mar 8, 2021

"omnisharp.monoPath": "/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono"

export MONO_HOME=/Library/Frameworks/Mono.framework/Versions/Current

@LoranceChen Sorry you are having issues getting the C# extension configured. It is not normally necessary to set the "omnisharp.monoPath" setting if mono is already on your PATH. If you do need to set it, then it should match your MONO_HOME environment variable. I will update the setting description with an example value that might make this more clear.

@heshuimu
Copy link

heshuimu commented Mar 8, 2021

I think people have this set was to workaround issues. Previously on an older Omnisharp + VS Code combination, I had the same mono not found issue, and I had to do this so that Omnisharp could pick up the Mono SDK path since the setting kept coming back as empty string in global settings.json after several attempt to remove it. Not sure if it was just a coincidence, but the issue did go away.

@LoranceChen
Copy link
Author

@JoeRobich thanks! I changed monoPath as /Library/Frameworks/Mono.framework/Versions/Current/ it works fine.
Besides, it can't work with same problem if I remove the monoPath config field. Perhaps other setting conflict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants