Omnisharp-vscode: Intellisense no longer working on C# files

Created on 5 Oct 2017  路  21Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output:

.NET Command Line Tools (2.0.0)

Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.15063
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.0.0\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

VS Code version: 1.16.1 64 bit

C# Extension version:
1.12.1

Steps to reproduce

I open a C# file and try to get intellisense. It did not working in the 32 bit version and I just now installed 64 bit. I uninstalled and reinstalled C# extension but cannot get any intellisense working in C#.

Expected behavior

Intelliense

Actual behavior

No intellisense in C#

Thanks

Needs More Info

Most helpful comment

This worked for me, it seems that the wrong project was being selected by Omnisharp:

  1. Open the command palette: Ctrl-Shift-P
  2. Type: Omnisharp: Select Project
  3. Select the correct project
  4. Open the command palette: Ctrl-Shift-P
  5. Type: Omnisharp: Restart Omnisharp

Then it started to work again.

All 21 comments

Could you provide your OmniSharp Log when this happens? You can retrieve it by selecting View->Output and then choosing "OmniSharp Log" from the drop-down in the top-right corner of the Output pane.

What the heck! It is working today. Didn't work at all yesterday, which is why I tried the 64 bit version. Then finally got around to logging the issue here last night when that didn't help. But today it works right off. I will check it out today and send logs if this crops up. THanks

I'm glad to hear that it's working now, but I'm sorry that you had an inconsistent experience. 馃槥

@DustinCampbell It is acting up this morning.

Here are the logs:

Starting OmniSharp server at 10/5/2017, 8:52:46 PM
    Target: c:\Users\v-jormc\Source\Repos\Xbox.Ambassadors\Microsoft.Ambassadors\Microsoft.Ambassadors.Web.Client

OmniSharp server started
    Path: C:\Users\v-jormc\.vscode\extensions\ms-vscode.csharp-1.12.1\.omnisharp\OmniSharp.exe
    PID: 15260

OmniSharp: -s c:\Users\v-jormc\Source\Repos\Xbox.Ambassadors\Microsoft.Ambassadors\Microsoft.Ambassadors.Web.Client --hostPID 13732 --stdio DotNet:enablePackageRestore=false --encoding utf-8 --loglevel information formattingOptions:useTabs=false formattingOptions:tabSize=4 formattingOptions:indentationSize=4
[info]: OmniSharp.Startup
        Omnisharp server running using Stdio at location 'c:\Users\v-jormc\Source\Repos\Xbox.Ambassadors\Microsoft.Ambassadors\Microsoft.Ambassadors.Web.Client' on host 13732.
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in c:\Users\v-jormc\Source\Repos\Xbox.Ambassadors\Microsoft.Ambassadors\Microsoft.Ambassadors.Web.Client
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Resolving projects references
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        OmniSharp initialized with Visual Studio MSBuild.

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        No solution files found in 'c:\Users\v-jormc\Source\Repos\Xbox.Ambassadors\Microsoft.Ambassadors\Microsoft.Ambassadors.Web.Client'
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: c:\Users\v-jormc\Source\Repos\Xbox.Ambassadors\Microsoft.Ambassadors\Microsoft.Ambassadors.Web.Client\Microsoft.Ambassadors.Web.Client.csproj
[ERROR] Error: OmniSharp server load timed out. Use the 'omnisharp.projectLoadTimeout' setting to override the default delay (one minute).

It looks like OmniSharp failed to load in time. Try setting omnisharp.projectLoadTimeout to a larger setting (the default is 60) in your VS Code preferences.

Seeing this on macOS 10.13 as well, using VSCode 1.17.1.

Setting omnisharp.projectLoadTimeout to 360 still fails in the same way. It looks like something is trying to compile or load when vscode starts, there's a mono.osx process from inside the omnisharp extension[1] pinning the CPU to 100%, which seems to either hit a timeout or fail.

[1] .vscode/extensions/ms-vscode.csharp-1.12.1/.omnisharp/mono.osx

It has been working for me for the last several days. Not 100% sure what was going on.

Did you anyone of you fellas get intellisense working on macOS 10.13? Has this particular issue been resolve?

FWIW, I'm using macOS 10.13 and have not seen the problem.

I use Unity with VSCode, btw, and just wanted to jive in and say that everything went back to normal for me after:

  1. Uninstalled VSCode
  2. Deleted extensions in ~/.vscode/extensions folder
  3. Deleted all .csproj and .sln files in my project folder
  4. Re-installed VSCode
  5. Re-installed C# extension
  6. Re-opened the project via Unity's VSCode utility (which should automatically re-generate necessary .csproject and .sln files)

After which even the log outputs were now working. Before, it was like the extension wasn't even installed.

It started working for me again. I am not entirely sure why. Will keep an eye on it of course!

I am having the same issue, but it is because the c# extension does not load after it downloads OmniSharp. This is not consistent as I am running the same versions on another system and everything works fine with the same folder and files.

I have uninstalled and reinstalled VS Code and the extension multiple times with VS code restarts and PC restarts between loads.

capture

I am new to VS code, so forgive this question, but is there a way to look at the VS Code logs to see why the extension is not loading.

dotnet --info
.NET Command Line Tools (2.0.0)

Product Information:
Version: 2.0.0
Commit SHA-1 hash: cdcd1928c9

Runtime Environment:
OS Name: Windows
OS Version: 10.0.16299
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.0.0\

Microsoft .NET Core Shared Framework Host

Version : 2.0.0
Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

The only difference on the system where the extension works is OS Version: 10.0.15063

@leehanslim, Is there a way to skip 1, 4, and 5?

I don't know how to reinstall them other than downloading again.

@vthokie93 : Could you check your %UserProfile%\.vscode\extensions folders and see if there are multiple ms-vscode.csharp extensions installed?

This worked for me, it seems that the wrong project was being selected by Omnisharp:

  1. Open the command palette: Ctrl-Shift-P
  2. Type: Omnisharp: Select Project
  3. Select the correct project
  4. Open the command palette: Ctrl-Shift-P
  5. Type: Omnisharp: Restart Omnisharp

Then it started to work again.

I'm using Unity 2017.3.0f11 on OSX 10.12.6 and I just switched to VS Code and Omnisharp yesterday, since UT will soon drop the MonoDevelop support (which I was using before).
At first I thought Intellisense wasn't working for the biggest projects I have here, but turns out it's just super slow to load. I had to set omnisharp.projectLoadTimeout from 60 to 360 to be able to use it. It wasn't the case with a small project instead, which took 4 seconds or so to load.

VS Code feels much better than MonoDevelop, but how come this is so slow to load Intellisense compared to MonoDevelop (which took seconds no matter the size of the project)?

One thing that can be done to alleviate the projectLoadTimeout is to install the latest Mono release from http://www.mono-project.com/download. When C# for VS Code finds a newer version of Mono on the machine, it will try to use that to run OmniSharp. This is often beneficial because the Mono installation includes ahead-of-time compiled binaries for framework assemblies, which allow OmniSharp to run quite a bit more quickly.

I have experienced the same problem after running the command "dotnet new xxxx"

  • VSCode Version: 1.21.1 (x64)
  • OS Version: Microsoft Windows 10 Enterprise x64 version 1709 (OS build 16299.309)

Steps to Reproduce:

  1. Create a workspace with many projects
  2. Create a new folder in somewhere
  3. Run the command "dotnet new classlib -n xxxx -o yyyyyy (use the folder created in item 2)
  4. Try to use intellisense

Actual behavior

No intellisense in C#

Actions

After restarting Visual Studio Code, intellisense works fine.

Thanks.

@DiegoGFritz: Your experience is a different issue. If VS Code is already open, the OmniSharp server won't discover new projects. You can get OmniSharp to reload the projects by running Restart OmniSharp from the VS Code command palette.

Ok. Thanks for the reply. I will try it

Closing this older issue out - there have been a lot of improvements to OmniSharp over the past 3 years, and it's likely that this issue was resolved. But if you still see it with an updated VSCode and C# plugin, please ping here and we can re-open it.

Was this page helpful?
0 / 5 - 0 ratings