vscode-csharp: Intellisense not working at all ...

Environment data

.NET Core SDK (reflecting any global.json): Version: 2.1.402 Commit: 3599f217f4

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

Host (useful for support): Version: 2.1.4 Commit: 85255dde3e

.NET Core SDKs installed: 2.1.300 [C:\Program Files\dotnet\sdk] 2.1.402 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

VS Code version: 1.27.2

C# Extension version: 1.16.1

Steps to reproduce

I opened a C# sharp file on a ASP.NET Core project.

I reinstalled Visual Studio Code and Omisharp as well as ASP.NET Core runtimes and SDK and I keep having the same problem. Problems with Intellisense not working has been something very common …

Expected behavior

Intellisense to display options after typing a dot …

Actual behavior

Intellisense is not working … No options are displayed.

Exception

I checked the developer console and get the following:

[Extension Host] [ms-vscode.csharp] Accessing a resource scoped configuration without providing a resource is not expected. To get the effective value for '[csharp]', provide the URI of a resource or 'null' for any resource.

[Extension Host] rejected promise not handled within 1 second

ERR Pending request cancelled: /codecheck: Error: Pending request cancelled: /codecheck
	at RequestQueue.cancelRequest (C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\out\src\omnisharp\requestQueue.js:45:29)
	at RequestQueueCollection.cancelRequest (C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\out\src\omnisharp\requestQueue.js:115:15)
	at token.onCancellationRequested (C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\out\src\omnisharp\server.js:394:40)
	at e.fire (c:\Users\Mig\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:99:917)
	at e.cancel (c:\Users\Mig\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:106:130)
	at e.cancel (c:\Users\Mig\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:106:854)
	at DiagnosticsProvider._validateDocument (C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\out\src\features\diagnosticsProvider.js:161:44)
	at DiagnosticsProvider._onDocumentAddOrChange (C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\out\src\features\diagnosticsProvider.js:136:18)
	at DiagnosticsProvider.vscode.workspace.onDidChangeTextDocument.event (C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\out\src\features\diagnosticsProvider.js:110:73)
	at e.fire (c:\Users\Mig\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:99:937)
	at e.$acceptModelChanged (c:\Users\Mig\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:742:362)
	at e._doInvokeHandler (c:\Users\Mig\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:681:309)
	at e._invokeHandler (c:\Users\Mig\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:681:27)
	at e._receiveRequest (c:\Users\Mig\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:679:802)
	at e._receiveOneMessage (c:\Users\Mig\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:678:993)
	at c:\Users\Mig\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:677:791
	at c:\Users\Mig\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:98:597
	at e.fire (c:\Users\Mig\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:99:917)
	at a (c:\Users\Mig\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:164:787)
	at Socket._socketDataListener (c:\Users\Mig\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:164:1006)
	at emitOne (events.js:116:13)
	at Socket.emit (events.js:211:7)
	at addChunk (_stream_readable.js:263:12)
	at readableAddChunk (_stream_readable.js:250:11)
	at Socket.Readable.push (_stream_readable.js:208:10)
	at Pipe.onread (net.js:594:20)

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 4
  • Comments: 22 (8 by maintainers)

Most upvoted comments

@mdmoura I think I understand what might be happening. OmniSharp is loading only the API project, hence you are getting complete intellisense support for that project, and for the files in other projects you are getting only basic support(which doesnot look into the project definition). Can you try “OmniSharp --> Select Project”, you should see a drop down with all the project names, and selecting a project would make the intellisense work for it.

We are tracking work related to adding Multi-Root Workspace support here: https://github.com/OmniSharp/omnisharp-vscode/issues/1889.

@mdmoura If you load a solution that contains all the projects, then intellisense will work for all if them, however omnisharp currently doesnt support loading multiple projects in a multi-root workspace.

Another troubleshooting strategy to try if none of the above works out is uninstalling Mono. I also experienced a sudden disappearance of Intellisense after pulling changes to one of our enterprise repos that included an upgrade from ASP.NET Core 2.0 to 2.1. Strangely, at the same time, Intellisense was working fine in another C# project repo running ASP.NET Core 2.2.

For the project in question, I was puzzled to see successful logs for each reboot of the Omnisharp server as well as perfectly clean builds and runs. The puzzlement increased as I compared these Omnisharp logs to those from 2.2 project and found them practically identical.

Upon uninstalling Mono, the one detail that changed is how Omnisharp started. Now it boots up from a shell script located at ~/.vscode/extensions/ms-vscode.csharp-1.19.0/.omnisharp/1.32.18/run. Previously, Mono itself was booting the server from the executable at ~/.vscode/extensions/ms-vscode.csharp-1.19.0/.omnisharp/1.32.18/omnisharp/Omnisharp.exe.

Other troubleshooting I attempted to no avail:

  • dotnet clean / Deleting bin and obj directories
  • Updating launch.json to point at the proper bin/Debug/netcoreapp2.1 build directory
  • Wiping my local nuget cache
  • Restarting Omnisharp
  • Uninstalling and reinstalling VS Code, as well as bumping back a version from 1.33.1 as the breakage coincided oddly with the March 2019 update
  • Uninstalling and reinstalling the C# VS Code extension, as well as bumping back a version from 1.19.0 given other users’ reports of said version interfering with Intellisense for certain projects
  • Adding a global.json file at project root to override default utilization of latest .NET Core SDK (mine was 2.2.105) and run instead using 2.1.302 in concert with the project’s version
  • Wiping/rebuilding the project .sln file

Specs: VS Code 1.33.1, C# Extension 1.19.0, MacOS High Sierra 10.13.6.

@monefeldt I am not sure why it could not find that dll. Could you try setting “Omnisharp.path–>latest” and restarting the omnisharp server

Thanks, that did the trick!

@monefeldt I am not sure why it could not find that dll. Could you try setting “Omnisharp.path–>latest” and restarting the omnisharp server

@akshita31

Can you try “OmniSharp --> Select Project”

So I selected the Auth project on Ominsharp and now Intellisense works on it … but stopped working on the API project.

Shouldn’t work in all projects without the need of changing on Omnisharp?

A suggestion:

Shouldn’t the omnisharp.projectLoadTimeout default value be increased?

Better would be to improve Omnisharp CPU consumption to run faster …