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

Unable to start OmniSharp when opening Unity project #691

Closed
soren-creates opened this issue Aug 19, 2016 · 8 comments
Closed

Unable to start OmniSharp when opening Unity project #691

soren-creates opened this issue Aug 19, 2016 · 8 comments

Comments

@soren-creates
Copy link

Environment data

.NET Command Line Tools (1.0.0-preview2-003121)

Product Information:
Version: 1.0.0-preview2-003121
Commit SHA-1 hash: 1e9d529bc5

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.11
OS Platform: Darwin
RID: osx.10.11-x64

VS Code version:
Version 1.4.0 (1.4.0)

C# Extension version:
1.4.0-beta5

Steps to reproduce

  1. Open Unity project in VS Code

Note: This issue also occurs with C# extension versions 1.3.0 and 1.3.0-beta1.

Expected behavior

Omnisharp doesn't finish starting

Actual behavior

Omnisharp finishes starting

Omnisharp Log

Flavor: 1, Platform: 2
[INFO] Installing OmniSharp to /Users/Austin/.vscode/extensions/ms-vscode.csharp-1.4.0-beta5/out/.omnisharp-mono
[INFO] Attempting to download https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta13-mono.tar.gz
[INFO] Downloading to /var/folders/yk/8ppdgm6s5y790ft_w5drdvxc0000gn/T/tmp-41055NwGi3eW0PoS.tmp...
[INFO] Download complete!
[INFO] Decompressing...
[INFO] Done! 160 files unpacked.
[INFO] Starting OmniSharp at '/Users/Austin/Repositories/supersecret/supersecret.sln'...

@DustinCampbell
Copy link
Member

Thanks for reporting this problem. I've got a few questions:

  • Is this the full OmniSharp log? That is, you didn't trim it at all did you?
  • What version of Mono do you have installed? (You can run mono --version in a Terminal window to find out.)
  • Could you try the latest beta of the extension? We've improved some of the logging and I'd be interested to know if there's any change.

Thanks!

@fregren
Copy link

fregren commented Aug 27, 2016

I had the same problem (and same full log).

I was not using the beta and haven't tried it yet. Im using 1.3.

Doing mono --version didn't work, since my mono came from Unity and seemingly wasn't setup in the path. So OmniSharp could probably not find it. Without using the beta I could solve it in two ways:

  1. Installing mono manually, e.g. downloading it from http://www.mono-project.com/download/ or using brew install mono.
    Not sure how much this will conflict with Unity using an older version. Unity itself is probably not affected by this since I believe it still uses it's own version. However, I guess one might risk getting autocompletion for things Unity doesn't support.
  2. Create a symlink to MonoDevelop's mono:
    ln -s /Applications/Unity/MonoDevelop.app/Contents/Frameworks/Mono.framework/Versions/Current/bin/mono /usr/local/bin/
    I'm not sure if that version is supported by Visual Studio Code, but in my very brief usage so far it works.
    Update: Since this is MonoDevelop's version it could probably also give suggestions not supported by Unity.
    Update: Rephrased symlink text to correctly state that I symlinked to MonoDevelop's mono, not Unity's. Unity's version is too old as pointed out by @DustinCampbell.

@DustinCampbell
Copy link
Member

That's great information @fregren -- thanks!

@DustinCampbell
Copy link
Member

FWIW, I would expect option 2 to be reasonably safe. OmniSharp requires at least Mono 4.0.1, which it checks for before launching by running "mono --version". Assuming that code is running correctly, it should be fine.

@fregren
Copy link

fregren commented Aug 27, 2016

Ah, I'm a bit daft! I linked to MonoDevelop's Mono not Unity's! MonoDevelop uses mono 4.05 whereas Unity uses 2.6.5.
Actually linking to Unity's mono will cause the OP's problem to persist. Probably because of the version check @DustinCampbell mentioned.

So the risk of getting suggestions not supported by Unity as mentioned in my suggestion #1 would apply to #2 as well, albeit probably less so than downloading the latest and greatest mono.

@anirbanbm
Copy link

Thanks fregren for the solution. It worked perfectly for me :)
My OmniSharp log just looked like (1 line):
[INFO] Starting OmniSharp at '/Users/baniz/Documents/gitRoot/Test/Test.sln'...

It would be great if it mentioned something like, "Could not find mono."
It is a huge relief to see the "Go to Definition" option now. Great plugin guys!!!

@DustinCampbell
Copy link
Member

Thanks! I'll take a look at some better logging around the Mono dependency.

@DustinCampbell
Copy link
Member

OK. I think this should be addressed in the latest release (1.5.2). Now, OmniSharp will be launched using an embedded Mono runtime rather than depending on Mono being installed system wide. However, you will need to have Mono installed somewhere (and mono on the path) in order to resolve the reference assemblies needed to provide IntelliSense. Installing via home brew should do the trick.

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

No branches or pull requests

4 participants