Omnisharp-vscode: Omnisharp refuses to start when VS Code is started from Unity

Created on 11 Apr 2017  路  102Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output:
.NET Command Line Tools (1.0.0-preview2-003133)

Product Information:
Version: 1.0.0-preview2-003133
Commit SHA-1 hash: 74df06500c

Runtime Environment:
OS Name: Windows
OS Version: 10.0.15063
OS Platform: Windows
RID: win10-x64

VS Code version: 1.11.1
C# Extension version:1.8.0

Steps to reproduce

Open Project in Unity
Assets->Open C# Project

installing omnisharp
post installation
restarting omnisharp
no flame icon

Omnisharp will not start and no Intellisense.

Expected behavior

Omnisharp starts

Actual behavior

Omnisharp will not start.

I can get it to start if I run "dotnet new" within my project directory. This creates a project.json file that appears to halfway work (It has no concept of any Unity classes, methods, functions). It also reports All my classes and methods as being ambiguously defined.

Interestingly, if I set VS2015 as my Unity editor, Intellisense works just fine.

Resolved-External

Most helpful comment

I had the same issue. Seems like it's caused by adding *.sln and *.csproj to your "files.exclude" setting.

All 102 comments

Don't create a project.json file. That causes nasty issues (like the classes and methods being ambiguously defined). This will not solve the problem in the way you might want it to.

Could you provide your OmniSharp log? Just load your Unity project in VS Code and then select View->Output from the VS Code menu. Choose "OmniSharp Log" from the drop-down at the top-right of the Output pane to display the log. Copy and paste it here.

Dustin,

There is no output, I get absolutely NOTHING that gives me a hint as to what's going on (or not going on as the case may be) In fact there is not "OmniSharp Log" entry in the drop down.

Do you have an OmniSharp status bar item on the far bottom right of the status bar? It should have a little "flame" OmniSharp logo.

image

Try clicking that status bar item. Clicking that should display a drop-down where you can pick your solution file:

image

Dustin, the fourth image above (circled horribly in red) shows what my status bar looks like.

When I use the Command Palette->OmniSharp: Select Project I get this...
image

If it's helpful my project directory looks like this after select "Open C# Project"
image

I'm a bit confused. Do you have any other extensions installed? Could you check %USERPROFILE%.vscode\extensions and let me know what is there?

You and me both!

Here's the Extensions Panel in VSCode (I actually did a complete uninstall/reinstall cycle over the weekend in the hopes that that would fix things)...

image

```PS C:\Users\rhace> cd ..vscode\extensions\
PS C:\Users\rhace.vscode\extensions> dir

Directory: C:\Users\rhace\.vscode\extensions

`Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2017-04-08 11:33 AM ms-vscode.csharp-1.8.1
d----- 2017-04-10 4:39 PM ms-vscode.mono-debug-0.15.4
d----- 2017-04-08 11:12 AM Tobiah.unity-tools-0.1.9
d----- 2017-04-08 11:11 AM Unity.unity-debug-1.1.0
d----- 2017-04-07 8:09 AM vscodevim.vim-0.6.15```

One of the reasons I'm confused is because you described adding a project.json file and getting ambiguity errors in VS Code, which would require OmniSharp to load. However, other descriptions (such as no OmniSharp Log being available) would indicate that it's not being loaded.

Oh, when the dotnet new command didn't work as expected I scrubbed all that

Code pre-dotnet new
image

Code post-'dotnet new`
image

I now also have a log file from OmniSharp...

```
Starting OmniSharp server at 4/11/2017, 5:42:27 PM
Target: c:\Users\rhace\Documents\code\Catlike - Clock

OmniSharp server started
Path: C:\Users\rhace.vscode\extensions\ms-vscode.csharp-1.8.1\bin\omnisharp\OmniSharp.exe
PID: 16552

OmniSharp: -s c:\Users\rhace\Documents\code\Catlike - Clock --hostPID 12728 --stdio DotNet:enablePackageRestore=false --encoding utf-8 --loglevel information formattingOptions:useTabs=false formattingOptions:tabSize=4 formattingOptions:indentationSize=4
Omnisharp server running using Stdio at location 'c:\Users\rhace\Documents\code\Catlike - Clock' on host 12728.
Initializing in c:\Users\rhace\Documents\code\Catlike - Clock
Auto package restore: False
Update workspace context
Update project c:\Users\rhace\Documents\code\Catlike - Clock
Add project c:\Users\rhace\Documents\code\Catlike - Clock\project.json => 3eb49979-71c0-4724-b365-f9f4d9bd088c
Resolving projects references
Processing [ProjectState] Catlike - Clock/.NETCoreApp,Version=v1.0
Added 2 and removed 0 documents.
MSBUILD_EXE_PATH environment variable set to C:\Users\rhace.vscode\extensions\ms-vscode.csharp-1.8.1\bin\omnisharp\msbuild\MSBuild.exe
MSBuildExtensionsPath environment variable set to C:\Users\rhace.vscode\extensions\ms-vscode.csharp-1.8.1\bin\omnisharp\msbuild
MSBuildSDKsPath environment variable set to C:\Users\rhace.vscode\extensions\ms-vscode.csharp-1.8.1\bin\omnisharp\msbuild\Sdks
Detecting projects in 'c:\Users\rhace\Documents\code\Catlike - Clock\Catlike - Clock.sln'.
Loading project from 'c:\Users\rhace\Documents\code\Catlike - Clock\Assembly-CSharp.csproj'.
Add project: c:\Users\rhace\Documents\code\Catlike - Clock\Assembly-CSharp.csproj
Update project: Assembly-CSharp
Detecting CSX files in 'c:\Users\rhace\Documents\code\Catlike - Clock'.
Could not find any CSX files
Configuration finished.
Watcher: c:\Users\rhace\Documents\code\Catlike - Clock\project.lock.json updated.
Update workspace context
Update project c:\Users\rhace\Documents\code\Catlike - Clock
Resolving projects references
Processing [ProjectState] Catlike - Clock/.NETCoreApp,Version=v1.0
Added 73 and removed 0 file references```

And if you close VS Code, delete that project.json file and re-open the same folder in VS Code, you don't get a log at all?

That is exactly correct!

Do you have a C# file open in the editor?

image

I do.

I"ve gotta go cook my wife and daughter dinner, but I'll be around later. I'd love to learn what boneheaded thing I'm doing that is preventing this from working!

Thanks for your help so far!

Ok. I'm wondering if one of the other extensions on your machine is interfering with C# for VS Code. What happens if you uninstall everything but C# for VS Code and restart VS Code?

I just tried all of the extensions you listed and wasn't able to reproduce the problem on my own project. Could you try the following?

  1. Open VS Code.
  2. Select File->Close Folder from the menu to close your project.
  3. Select Help->Toggle Developer Tools
  4. In the Developer Tools, select the "Console" tab.
  5. Select File->Open Folder from the menu and open your project folder (the one containing the .sln file).

I'm assuming there's no OmniSharp Log. Does anything appear in the Developer Tools console?

This is what I see there...

extensionHost.ts:284 [Extension Host] Error: ENOENT: no such file or directory, scandir 'C:\Users\rhace\AppData\Local\GitHub'
    at Error (native)d.logExtensionHostMessage @ extensionHost.ts:284(anonymous function) @ extensionHost.ts:139emitTwo @ events.js:106emit @ events.js:191process.nextTick @ internal/child_process.js:744_combinedTickCallback @ internal/process/next_tick.js:67_tickCallback @ internal/process/next_tick.js:98

Dustin,

Was that any help?

Sorry for the delay here. It's clear that _some_ extension is failing here, though it's not clear which one or whether that failure is conflicting with C# or not.

I've heard some reports of a particular extension inside of VS Code failing and causing strange behavior in C# for VS Code. Could you try something for me? In VS Code, invoke the "SCM: Disable Preview SCM" command from the command palette. You can display the command palette with Ctrl+Shift+P.

Dustin,

I've done that, and no change.

I've closed unity, and wiped out the .sln file and the two Assembly-CSharp* files and started both again and no change.

I followed the steps above with regard to the Developer Tools and there is now no output on Console tab.

I just did an uninstall/reinstall and the version of VSCode is now 1.11.2.

OmniSharp is still not starting.

Dustin,

Just wanted you to know that I've attempted removing all extensions but C#, and I have the same results.

I was getting this same behavior, this is what fixed it for me:

Code -> Preferences -> Settings

I had the setting "omnisharp.useMono": true (the default is false). Removing that from my settings file let the omnisharp server start back up.

Same issue here... It was working on another project but on this one I'm working on it omnisharp doesn't show.

@acidic9: Are you sure it's the same issue? Are you on Windows? Do you not have an OmniSharp log?

I am on windows, but I am not sure how to view the log

I don't have the OmniSharp log in my output window as seen here:
Missing OmniSharp Logs

Thanks for verifying. That does sound like the same issue. Any chance you could share your project?

Welp, after reopening VSCode a few times, my laptop's fan started spinning and suddenly the omnisharp icon in the bottom right appeared and it worked.

The issue was it was taking a very long time to load.

Thanks for the quick responses.

Hmm... That's a little bizarre too. 馃榾

Oh I think I found something that could help people having the same issue...

If your Unity project is very large, try changing the setting omnisharp.projectLoadTimeout to something greater than 60. It might just need a little extra time to load.

Even if the project load timed out, there should've been an OmniSharp Log. That's what struck me as bizarre.

Yeah it is pretty strange, I'm not sure what it could be then but it's working now so it's all good.

After seeing these notes, I got rid of of my "omnisharp.useMono": true" entry in preferences and updated my timeout to 120, but still no luck.

You had "omnisharp.useMono" set? That is super-unnecessary on Windows, since OmniSharp just runs on the desktop .NET Framework. Do you have other options set?

Dustin, It was one of the things I was attempting to do to get it work and had failed to get rid of it.

Here're my preferences....

// Place your settings in this file to overwrite the default settings
{
    "files.exclude": {
        "**/*.js": true,
        "**/.vs": true,
        "**/.vscode": true,
        "**/*.csproj": true,
        "**/*.sln": true,
        "**/.collabignore": true,
        "**/Fonts": true,
        "**/Images": true,
        "**/Music": true,
        "**/*Textures": true,
        "**/VSCode": true,
        "**/*Themes": true,
        "**/Prefabs": true,
        "**/Materials": true
    },
    "window.zoomLevel": 0,
    "editor.codeLens": true,

    "workbench.experimental.colorCustomizations": true,

//    "omnisharp.useMono": true,
    "omnisharp.projectLoadTimeout": 120,
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\Sysnative\\bash.exe"
}

@rhacer63 The steps I followed was simply reopening and closing VSCode a few times. Also, I'm using a plugin in Unity to launch VSCode (by following this tutorial). This plugin automatically created a file in .vscode/launch.json which contains the following:

{
    "version":"0.2.0",
    "configurations":[ 
        {
            "name":"Unity",
            "type":"mono",
            "request":"attach",
            "address":"localhost",
            "port":9596
        }
    ]
}

This plugin isn't necessary to get OmniSharp to work, I'm just mentioning it because notice it adds "type": "mono".

My only suggestion is relaunch VSCode and wait to see if it loads after a minute.

@Acidic9 Thanks for the tips! I started off NOT using dotBunny's plugin, when things didn't work as expected I installed it, and then converted back to not using it when things continued to no work.

I did, however, just create that launch.json file in my project's .vscode directory as I didn't have one. Still no luck.

@rhacer63 Sorry, to hear that. I think the launch.json has nothing to do with it honestly, it's the only suggestion I had. Does the project you're working in contain a huge number of files?

@Acidic9 not at all, less than 20, but I have the same problem with a 1 file test project I created in Unity to start debugging this problem.

Correct. @rhacer63 is experiencing a much more significant problem in that the C# extension does not even seem to be loaded.

This problem is occurring again for me. Sometimes it wants to work and sometimes it doesn't.

The issue is project-specific. I just switched to my previous project which I knew OmniSharp worked on fine and it works perfectly there... I switched back to this new project and it doesn't load.

@Acidic9: If you could share that project, it'd definitely be easier to help out.

Sorry for the late reply, it's 600+ mb and I don't have fantastic internet. This project 100% has the issue, I'm curious to see if you have the same issue with the specific project.

But here is the link: http://www.mediafire.com/file/ge3tvbkwgad83nm/OmniSharp_not_working_here_%28Unity_Project%29.zip

@Acidic9: I opened your project and found a couple of things;

  1. It's so big because it includes your Builds folder
  2. It doesn't actually include any csproj or sln files. Without those, OmniSharp has nothing to launch with.

I got a new version of the C# extension. I closed my project folder and Unity, deleted the .vscode directory in my project, and the *.csproj and *.sln files. Restarted everything and I'm sad to report that there has been no improvement.

If the csproj and sln files don't exist, OmniSharp won't be able to load. Is that what you've been doing this whole time? The project and solution files are essential for OmniShato make sense of your code.

@DustinCampbell Unity creates them when using the "Open C# Project" I just wanted to make sure that there was nothing in any of those files that was preventing OmniSharp from starting.

image

Dustin,

Is there anything I can do to help you? I'm on the East Coast, but at my desk all day so am willing to undertake any sort of debugging and inspection you might need.

@DustinCampbell - here is the simplest project that Unity will generate. It includes a single .cs file, a csproj, sln file, and all of the other supporting files it needs:

https://www.dropbox.com/s/h48163cfr5n6bg3/simple_unity_test_csharp.zip?dl=0

@tamirh I've downloaded that project with the same results (I didn't expect anything different but wanted to close that loop).

Hmm, I think I have an idea. as @DustinCampbell said, it needs those files to reference to.
Maybe Unity only creates those files once you open it in an editor that needs them such as Visual Studio 2015/2017

Maybe someone should open their project with Visual Studio 2015/2017 first, then try with Visual Studio Code?

(Can't do it right now sorry but it's just an idea I had)

_(possible)_ SOLUTION:
Open your project with MonoDevelop or Visual Studio 2015/2017 first, then reopen VSCode.

_(possible)_ PROBLEM:
Unity doesn't create the .sln file in the root of your project unless you open it with an editor. I guess VSCode doesn't tell it to generate the .sln file for some reason.


This is not OmniSharp's issue. Sorry for this long discussion here haha, hopefully this helps anyone with the problem.

VS Code doesn't do anything special for Unity projects. From VS Code's perspective, they are simply projects and solutions targeting .NET Framework or Mono.

There is a great "getting started" for Unity and VS Code at https://code.visualstudio.com/docs/other/unity. That document describes this process for getting setup.

@Acidic9 Just tried it out (brand new installation of VS17 with the Unity Tools installed). Everything works great in VS17, but on changing back to VSC, things are back to my "normal".

@rhacer63 Check the root of your project, did it create an .sln file with the same name as your project folder?

Also, did you restart VSCode?

Also, maybe try opening with Monodevelop first to see if it will create the file for you?

@Acidic9 Yep, there's an sln file and two Assembly files. I can close Unity and VSC delete those files and Unity will recreate them, but unless I run dotnet new in that root directory, OmniSharp won't start, and running dotnet new creates several other problems.

Hmm then I have no more ideas, I thought that was the solution. I'm not sure what else you can try, sorry.

@Acidic9 I lived a long time without anything like Intellisense. At the moment, I'm just running VSCode and pretending I don't know that Intellisense should work (because aside from Vim, it quickly bubbled to the top of favorite editors).

@rhacer63 Yeah of course, VSCode is the best out there (from testing many), there's a reason why I want to use VSCode over Visual Studio 2017 and Monodevelop etc.

Hopefully you can find a solution soon, just one more thing to check is make sure VSCode has opened the project folder rather than the single file and try using both these OmniSharp options to refresh OmniSharp entirely.

Omnisharp options

@Acidic9 Starting with your second point, I've tried both options there Select Project provides an empty list.

Your first point, I'm unsure how to validate. My understanding is that the Assets->Open C# Project should do that, but from within VSC, I don't know how to ascertain that I've opened a folder rather than a single file. The sidebar certainly lists all my files and its root is my project root, but I'm not sure if that actually answers the question or not.

@rhacer63 Yeah seeing as you see all the files from the root of your project, it means you have your project open. Sorry I have 0 more ideas. I managed to get it working for myself with what you said, just clicking Assets -> Open C# Project (with Monoedit as the default editor in preferences) which created the necessary sln file and now it's working just fine. In your case, I'm lost. Sorry.

@Acidic9 I appreciate your taking the time!

image

I needed to share that.

My Surface Book screen started going south. I took it to the MS Store today, and they swapped out my old SB for a brand new one. Of course that meant I had to re-install everything from scratch, and when I did Omnisharp started working.

Here's what I think happened. When I first fired up VSC I was told that the CLI tools were missing. When OmniSharp installed, it said it couldn't run the dotnet command. This time, instead of asking to install the CLI tools I said "Ignore the warning." My bet is the presence of the CLI tools is what borked my original installation. I'm not going to try and prove that (at least not at the moment) but thought I would pass along my findings.

Well that was a short-lived celebration. One reboot later and things are back to where they were before.

I do see an error message regarding the dotnet cli tools It's flagged as a C# error and not an OmniSharp error though. Failed to spawn 'dotnet --info'

One more note, I wish I'd taken a picture. One time I received an error message at the top of the window saying "OmniSharp Server not running" or something along those lines. I've been trying to duplicate that message, but so far have failed.

I had a similar issue with my VS Code editor. I was trying to run a web app on netcoreapp1.1 framework. When I used the Command Palette->OmniSharp: Select Project, I got "Select 1 of 0 projects". VS Code failed to start omnisharp and I could not find any omnisharp logs. All I did was to create a .sln file [with no contents in it] in the root of my project. I closed out of the editor and when I relaunched my project in VS Code...voila... Omnisharp was running and now I have intellisense for my project!

and of course, I renamed the .sln file to some dummy file extension soon after so that I could build my project....but omnisharp just needed its presence in the beginning. And btw, this was all done in a mac OS for building my asp.net core web application!

@inmallinath Thanks for trying to help. I'll try anything! Sadly no luck! Your idea prompted me to try several variations of opening VSC and the project folder without Unity running, but I got the same environment each time.

@DustinCampbell the only thing that's different since the re-install is that I now get the Failed to spawn 'dotnet --info' message every time VSC starts. However, it seems that since it actually worked once, that error is likely spurious.

@rhacer63: That is happening because of this:

Here's what I think happened. When I first fired up VSC I was told that the CLI tools were missing. When OmniSharp installed, it said it couldn't run the dotnet command. This time, instead of asking to install the CLI tools I said "Ignore the warning." My bet is the presence of the CLI tools is what borked my original installation. I'm not going to try and prove that (at least not at the moment) but thought I would pass along my findings.

C# for VS Code does not install the the .NET CLI tools. On start up, the extension tries to run dotnet --info as part of trying to install the .NET Core debugger. If it can't find dotnet on your path, it displays a warning (code). There is a csharp.suppressDotnetInstallWarning VS Code setting that you can use to suppress the warning.

@DustinCampbell I have that configured. I just didn't know if that error may be pertinent in determining what may be going on.

Previously I DID have the .NET CLI tools installed.

I don't think that error would cause an issue. Although, if it worked the first time but not subsequent times, I'm not sure. @gregg-miskelly, can you think of anything that might fail here? I'm wondering if the promises in the debugger around checking for the dotnet install might cause subsequent promises (such as launching OmniSharp) not to run.

@DustinCampbell I can't think of any great theory as to how that could happen. Looking at main.ts. The OmniSharp activation actually gets kicked off first. So the only way something like that could happen would be if the debugger actually somehow entirely blocked the extension process from running.

@rhacer63 are still seeing the failed to spawn error? You can confirm/deny if this has anything to do with the debugger by opening up ~/.vscode/extensions/ms-vscode.csharp-1.9.0/out/src/main.js and commenting out the call to coreclrdebug.activate.

Thanks @gregg-miskelly, I didn't look to closely. Just theorizing.

@gregg-miskelly

I have commented out the line that reads coreclrdebug.activate(extension, context, reporter, logger, _channel);

@DustinCampbell That got rid of the dotnet --info diagnostic, however, the server did not start.

Just a note, I've upgraded to the May release of VSC. With no change in this behavior.

@rhacer63: Are you able to launch OmniSharp from the command-line?

I'm not sure what version you have installed, but it should be located in%UserProfile%\.vscode\extensions\ms-vscode.csharp-<version number goes here>\bin\omnisharp\OmniSharp.exe

Try running that from the command line with the following arguments: --stdio -s "<path to your solution file"

Absolutely. I just got a screen full of logging and it didn't exit, so I'm guessing it's running.

Well that's some validation I guess. :smile: My suspicion is still that VS Code (for some unknown reason) isn't even launching the C# extension at all.

I think this is some path related issue, though I don't know how to track that down. It sure feels like it!

It does feel that way. Is there anything interesting about the path that you're opening in VS Code? I.e. does it have spaces are anything else that might be interesting?

Yeah, my home directory is "Timothy Grant" (though it wasn't on the prior machine). Also all my code directories have spaces in them .\Documents\code\Timothys - Game etc. One moment while I test the theory...

So creating .\Documents\code\Bar as my project didn't solve the problem, but that still doesn't resolve the issue of the User home directory.

So I created a new project on my D: Drive D:\Foo\FooBar I was hopeful for a brief moment as it took a bit to open, but that hope was in vain.

I got same error.

@DustinCampbell Just downloaded the most recent extension and still have a failure to launch.

@DustinCampbell Just checking to see if any progress has been made here. If there's any other information I can provide that might help.

@DustinCampbell Anything?

Sorry @rhacer63. I've just gotten back from vacation.

Unfortunately, I haven't been able to reproduce this issue, so I don't have any news. 馃槥

@DustinCampbell I hope you had an extraordinarily good vacation!

Just in case it's useful, I can runOmniSharp from the command prompt

PS C:\Users\Timothy Grant\Documents\code\Logistica> ..\..\..\.vscode\extensions\ms-vscode.csharp-1.10.0\bin\omnisharp\OmniSharp.exe OmniSharp: info: OmniSharp.Startup[0] Omnisharp server running on port '2000' at location 'C:\Users\Timothy Grant\Documents\code\Logistica' on host -1. info: OmniSharp.DotNet.DotNetProjectSystem[0] Initializing in C:\Users\Timothy Grant\Documents\code\Logistica info: OmniSharp.DotNet.DotNetProjectSystem[0] Auto package restore: True info: OmniSharp.DotNet.DotNetProjectSystem[0] Update workspace context info: OmniSharp.DotNet.DotNetProjectSystem[0] Resolving projects references info: OmniSharp.MSBuild.MSBuildProjectSystem[0] MSBuild will use local Visual Studio installation. info: OmniSharp.MSBuild.MSBuildProjectSystem[0] Detecting projects in 'C:\Users\Timothy Grant\Documents\code\Logistica\Logistica.sln'. info: OmniSharp.MSBuild.MSBuildProjectSystem[0] Loading project: C:\Users\Timothy Grant\Documents\code\Logistica\Assembly-CSharp-firstpass.csproj info: OmniSharp.MSBuild.MSBuildProjectSystem[0] Loading project: C:\Users\Timothy Grant\Documents\code\Logistica\Assembly-CSharp.csproj info: OmniSharp.MSBuild.MSBuildProjectSystem[0] Loading project: C:\Users\Timothy Grant\Documents\code\Logistica\Assembly-CSharp-Editor-firstpass.csproj info: OmniSharp.MSBuild.MSBuildProjectSystem[0] Loading project: C:\Users\Timothy Grant\Documents\code\Logistica\Assembly-CSharp-Editor.csproj info: OmniSharp.MSBuild.MSBuildProjectSystem[0] Update project: Assembly-CSharp-firstpass info: OmniSharp.MSBuild.MSBuildProjectSystem[0] Update project: Assembly-CSharp info: OmniSharp.MSBuild.MSBuildProjectSystem[0] Update project: Assembly-CSharp-Editor-firstpass info: OmniSharp.MSBuild.MSBuildProjectSystem[0] Update project: Assembly-CSharp-Editor info: OmniSharp.Script.ScriptProjectSystem[0] Detecting CSX files in 'C:\Users\Timothy Grant\Documents\code\Logistica'. info: OmniSharp.Script.ScriptProjectSystem[0] Could not find any CSX files info: OmniSharp.Startup[0] Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider info: OmniSharp.Startup[0] Configuration finished.

I've also tried updating my preferences to include the following (though it didn't work):

"omnisharp.path": "C:\\Users\\Timothy Grant\\.vscode\\extentions\\ms-vscode.csharp-1.10.0\\bin\\omnisharp\\OmniSharp.exe"

I had the same issue. Seems like it's caused by adding *.sln and *.csproj to your "files.exclude" setting.

@codeRiftel How the heck did you figure that out? I just checked, and that did, indeed, resolve the issue. Entertainingly I've already shifted over to Rider, so no longer need the fix!

Seriously good detective work though.

head smack I had not considered that. Thanks for finding that @codeRiftel!

Since the issue has finally been solved (though I'm slightly sad that I wasn't able to figure it out :smile:), I'll go ahead and close this.

Got the same issue, @codeRiftel, use saved my day :D

Anyone else having this issue, you can have Unity 2017 generate the sln and csproj files by first setting your script editor to VSCode (Unity -> Preferences -> External Tools -> Script Editor). Then go to Assests -> Open C# Project. Once I did that and restarted VsCode it all seemed to work!

Unity 2017, Mac OS... solution for me was to upgrade Mono.

+1 thank you do @codeRiftel! This was driving me NUTS and that files.exclude thing seems to fix it!

Update:
Dang ... looks like that just turns off OmniSharp or something. I realized "Goto Definition" wasn't working so basically it looks like this hack just disabled OmniSharp/Intellisense or something maybe? Ugh ...

+1 on the "files.exclude" thing. It seems strange to me that OmniSharp cannot see the solution/project files when they are excluded from the "Explorer" pane.

Hey there, I found a solution
https://dotnet.microsoft.com/download/dotnet-framework/thank-you/net471-developer-pack-offline-installer
Install this and it will work (infact the omnisharp log also says to install this)

Was this page helpful?
0 / 5 - 0 ratings