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

Created on 18 Sep 2018  路  22Comments  路  Source: OmniSharp/omnisharp-vscode

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)
Bug

Most helpful comment

@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.

All 22 comments

  • 1 Hasn't been working for about a week.

Been having troubles myself for a week or so. OmniSharp.exe consumes lots of CPU. The joke around the office is that it's mining bitcoins 馃槅

Generally, I've been having to restart VS Code to get it working again. Seems to be related to the upgrade to version 1.16

In my case it stops working maybe half of the times I update Visual Studio Code ...

Sometimes, even without updating it and I need to reinstall everything ...

@floyd-may

OmniSharp.exe consumes lots of CPU

Yes, it also happens with me ...

@mdmoura Can you share your "OmniSharp log" and "C#" log. You can find it in the "View--> Output" pane.

@akshita31

I checked the Ominsharp Log and got the following:

 Starting OmniSharp server at 9/19/2018, 9:13:45 PM
     Target: c:\Users\Mig\MyProj.Api

 OmniSharp server started.
     Path: C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\.omnisharp\1.32.5\OmniSharp.exe
     PID: 16880

 [info]: OmniSharp.Stdio.Host
         Starting OmniSharp on Windows 6.2.9200.0 (x64)
 [info]: OmniSharp.Services.DotNetCliService
         DotNetPath set to dotnet
 [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
         Located 1 MSBuild instance(s)
             1: StandAlone 15.0 - "C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\.omnisharp\1.32.5\msbuild\15.0\Bin"
 [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
         MSBUILD_EXE_PATH environment variable set to 'C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\.omnisharp\1.32.5\msbuild\15.0\Bin\MSBuild.exe'
 [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
         Registered MSBuild instance: StandAlone 15.0 - "C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\.omnisharp\1.32.5\msbuild\15.0\Bin"
             CscToolExe = csc.exe
             CscToolPath = C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\.omnisharp\1.32.5\msbuild\15.0\Bin\Roslyn
             MSBuildExtensionsPath = C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\.omnisharp\1.32.5\msbuild
             MSBuildToolsPath = C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\.omnisharp\1.32.5\msbuild\15.0\Bin
 [ERROR] Error: OmniSharp server load timed out. Use the 'omnisharp.projectLoadTimeout' setting to override the default delay (one minute).

So I increased the omnisharp.projectLoadTimeout from 60 seconds to 120 seconds and I got:


 Starting OmniSharp server at 9/19/2018, 9:29:06 PM
     Target: c:\Users\Mig\MyProj.Api

 OmniSharp server started.
     Path: C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\.omnisharp\1.32.5\OmniSharp.exe
     PID: 1956

 [info]: OmniSharp.Stdio.Host
         Starting OmniSharp on Windows 6.2.9200.0 (x64)
 [info]: OmniSharp.Services.DotNetCliService
         DotNetPath set to dotnet
 [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
         Located 1 MSBuild instance(s)
             1: StandAlone 15.0 - "C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\.omnisharp\1.32.5\msbuild\15.0\Bin"
 [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
         MSBUILD_EXE_PATH environment variable set to 'C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\.omnisharp\1.32.5\msbuild\15.0\Bin\MSBuild.exe'
 [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
         Registered MSBuild instance: StandAlone 15.0 - "C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\.omnisharp\1.32.5\msbuild\15.0\Bin"
             CscToolExe = csc.exe
             CscToolPath = C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\.omnisharp\1.32.5\msbuild\15.0\Bin\Roslyn
             MSBuildExtensionsPath = C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\.omnisharp\1.32.5\msbuild
             MSBuildToolsPath = C:\Users\Mig\.vscode\extensions\ms-vscode.csharp-1.16.1\.omnisharp\1.32.5\msbuild\15.0\Bin
 [info]: OmniSharp.Cake.CakeProjectSystem
         Detecting Cake files in 'c:\Users\Mig\MyProj.Api'.
 [info]: OmniSharp.Cake.CakeProjectSystem
         Could not find any Cake files
 [info]: OmniSharp.WorkspaceInitializer
         Project system 'OmniSharp.DotNet.DotNetProjectSystem' is disabled in the configuration.
 [info]: OmniSharp.MSBuild.ProjectSystem
         No solution files found in 'c:\Users\Mig\MyProj.Api'
 [info]: OmniSharp.MSBuild.ProjectManager
         Queue project update for 'c:\Users\Mig\MyProj.Api\MyProj.Api.csproj'
 [info]: OmniSharp.Script.ScriptProjectSystem
         Detecting CSX files in 'c:\Users\Mig\MyProj.Api'.
 [info]: OmniSharp.Script.ScriptProjectSystem
         Could not find any CSX files
 [info]: OmniSharp.WorkspaceInitializer
         Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
 [info]: OmniSharp.WorkspaceInitializer
         Configuration finished.
 [info]: OmniSharp.Stdio.Host
         Omnisharp server running using Stdio at location 'c:\Users\Mig\MyProj.Api' on host 7172.
 [info]: OmniSharp.MSBuild.ProjectManager
         Loading project: c:\Users\Mig\MyProj.Api\MyProj.Api.csproj
 [info]: OmniSharp.MSBuild.ProjectManager
         Successfully loaded project file 'c:\Users\Mig\MyProj.Api\MyProj.Api.csproj'.
 [info]: OmniSharp.MSBuild.ProjectManager
         Adding project 'c:\Users\Mig\MyProj.Api\MyProj.Api.csproj'
 [info]: OmniSharp.MSBuild.ProjectManager
         Update project: MyProj.Api
 [info]: OmniSharp.MSBuild.ProjectManager
         Found referenced project outside root directory: c:\Users\Mig\MyProj.Core\MyProj.Core.csproj
 [info]: OmniSharp.MSBuild.ProjectManager
         Adding project 'c:\Users\Mig\MyProj.Core\MyProj.Core.csproj'
 [info]: OmniSharp.MSBuild.ProjectManager
         Queue project update for 'c:\Users\Mig\MyProj.Core\MyProj.Core.csproj'
 [info]: OmniSharp.MSBuild.ProjectManager
         Loading project: c:\Users\Mig\MyProj.Core\MyProj.Core.csproj
 [info]: OmniSharp.MSBuild.ProjectManager
         Successfully loaded project file 'c:\Users\Mig\MyProj.Core\MyProj.Core.csproj'.
 [info]: OmniSharp.MSBuild.ProjectManager
         Update project: MyProj.Core

Then I opened the Startup file of the ASP.NET Core project "c:\Users\Mig\MyProj.Api\MyProj.Api.csproj" with the following:

    public void ConfigureServices(IServiceCollection services) {
      String name = "Hello";      
      services.AddMvc();
    }

Now intellisense works if I type:

name.

But it does not work if I type:

services.

I do not have a C# log on the VS Code output only Omnisharp Log, Tasks, ...

Is it necessary to do something to enable C# log?

I tried the Quick method in:
https://github.com/OmniSharp/omnisharp-vscode/wiki/Enabling-C%23-debugger-logging

And then I opened the VS Developer Tools and go the following:

/C:/Users/Mig/AppData/Local/Programs/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:276 [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.

t.log @ /C:/Users/Mig/AppData/Local/Programs/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:276
/C:/Users/Mig/AppData/Local/Programs/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:1411 ERR An unknown error occurred. Please consult the log for more details.

@mdmoura Do other IDE features work for you? Like are you able to see the Codelens above the method names or the class names? If you do an F12 on the IServices interface do you get some result ?

@pgmitche Can you create a basic "dotnet new console" project and open it in vscode? Does anything work for you there ?

@akshita31

Do other IDE features work for you? Like are you able to see the Codelens above the method names or the class names? If you do an F12 on the IServices interface do you get some result ?

Yes, I am able to see Codelens above the method names and the class names.
If I hit F12 over IServiceCollection I get the message "No definition found for IServiceCollection".

I have 3 ASP.NET Core web projects on my Solution / VSCode workspace.

There is one project where Intellisense works for services variable and when I hit F12 over IServiceCollection I am taken to [metadata] IServiceCollection. That projects is the API.

The API is the first project on the workspace and on Omnisharp log it is the first one being referenced by Ominsharp when it startups ... Check my previous post.

It seems it is working for the first project but not for the other ones ...

This is the definition of the project where Intellisense is working for services:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>

  <PropertyGroup>
    <AssemblyTitle>Api</AssemblyTitle>
    <Description>Api</Description>
    <Authors>Mig</Authors>
    <Company>Cm</Company>
    <Copyright>Cm 2018</Copyright>
    <Version>$(Version)</Version>
    <NeutralLanguage>en-US</NeutralLanguage>   
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.4" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="2.3.0" />
    <PackageReference Include="FluentValidation" Version="8.0.100" />
    <PackageReference Include="IdentityServer4" Version="2.2.0" />
    <PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.6.0" />
    <PackageReference Include="IdentityServer4.AspNetIdentity" Version="2.1.0" />
    <PackageReference Include="MailKit" Version="2.0.6" />
    <PackageReference Include="MediatR" Version="5.1.0" /> 
    <PackageReference Include="Cm.Core" Version="2.1.4" />      
    <PackageReference Include="Scrutor" Version="3.0.1" />
    <PackageReference Include="Serilog" Version="2.7.1" />
    <PackageReference Include="Serilog.Extensions.Logging" Version="2.0.2" />
    <PackageReference Include="Serilog.Sinks.Literate" Version="3.0.0" />    
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\src\MyProj.Core\MyProj.Core.csproj" />
    <ProjectReference Include="..\..\src\MyProj.Data\MyProj.Data.csproj" />
  </ItemGroup>        

</Project>

And this is the definition of the project where Intellisense is not working for services:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>

  <PropertyGroup>
    <AssemblyTitle>Auth</AssemblyTitle>
    <Description>Auth</Description>
    <Authors>Mig</Authors>
    <Company>Cm</Company>
    <Copyright>Cm 2018</Copyright>
    <Version>$(Version)</Version>
    <NeutralLanguage>en-US</NeutralLanguage>   
  </PropertyGroup>  

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.4" />
    <PackageReference Include="FluentValidation" Version="8.0.100" />
    <PackageReference Include="IdentityServer4" Version="2.2.0" />
    <PackageReference Include="IdentityServer4.AspNetIdentity" Version="2.1.0" />    
    <PackageReference Include="MediatR" Version="5.1.0" /> 
    <PackageReference Include="Cm.Core" Version="2.1.4" />      
    <PackageReference Include="Scrutor" Version="3.0.1" />
    <PackageReference Include="Serilog" Version="2.7.1" />
    <PackageReference Include="Serilog.Extensions.Logging" Version="2.0.2" />
    <PackageReference Include="Serilog.Sinks.Literate" Version="3.0.0" />    
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\src\MyProj.Core\MyProj.Core.csproj" />
    <ProjectReference Include="..\..\src\MyProj.Data\MyProj.Data.csproj" />
  </ItemGroup>    

</Project>

They are identical and both build fine so I have no idea what is going on ...

@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.

I am having the same issue, omnisharp cannot load any of my projects (I've tried reinstalling dotnet sdk, vscode, csharp-extension -- on both windows and mac os).

I don't have the same error message as the guy above but on my Mac it's telling me that it can't fint "mscorlib.dll".
And on Windows it's telling me it can't find the .NET SDK.

@akshita31 I've tried the "Omnisharp --> Select Project" route, but it just gives me the same error message

@monefeldt Can you post the output from "OmniSharp log" ? Also, do you get the same errors if you run a basic "dotnet new console" application ?

@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 ...

I am having the same issue, omnisharp cannot load any of my projects (I've tried reinstalling dotnet sdk, vscode, csharp-extension -- on both windows and mac os).

I don't have the same error message as the guy above but on my Mac it's telling me that it can't fint "mscorlib.dll".
And on Windows it's telling me it can't find the .NET SDK.

@akshita31 I've tried the "Omnisharp --> Select Project" route, but it just gives me the same error message

I am facing the same issues
@akshita31

Error Log

The SDK 'Microsoft.NET.Sdk' specified could not be found.

at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject (System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, System.Object[] args)

@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.

@tejalbarot Can you post the complete "OmniSharp log" and also the output of dotnet --info ?

@akshita31

I organize the projects in a very common way, e.g.:

project.sln
project.code-workspace
/src
   /api-project
      api-project.csproj
   /auth-project
      auth-project.csproj
/test
   /api-test-project
      api-test-project.csproj
   /auth-test-project
      auth-test-project.csproj

In Visual Studio Code I load the Workspace file ...

Any ETA for when Omnisharp will be compatible with a Visual Studio Code Workspace?

Im bumping this thread, the same issue as the ones listed above is affecting all the members of my team. We've all tried reinstalling everything (Vscode, omnisharp, .net core sdk/runtime) but nothing seems to help us. We've tried doing a plain new console app but the problem persists no matter the form our C# projects take.

Latest output from Omnisharp on my machine, now it can't find mscorlib.dll

`Starting OmniSharp server at 10/1/2018, 11:02:16 AM
Target: /Users/monefeldt/Projects/Scandbio.Ecommerce/Scandbio.Ecommerce.sln

OmniSharp server started.
Path: /Users/monefeldt/.vscode/extensions/ms-vscode.csharp-1.16.1/.omnisharp/1.32.5/run
PID: 4744

The assembly mscorlib.dll was not found or could not be loaded.
It should have been installed in the /Users/monefeldt/.vscode/extensions/ms-vscode.csharp-1.16.1/.omnisharp/1.32.5/lib/mono/4.5/mscorlib.dll' directory.

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

Product Information:
Version: 2.1.4
Commit SHA-1 hash: 5e8add2190

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

Host (useful for support):
Version: 2.1.0
Commit: caa7b7e2ba

.NET Core SDKs installed:
1.0.0-preview2-003156 [/usr/local/share/dotnet/sdk]
1.0.4 [/usr/local/share/dotnet/sdk]
2.0.0 [/usr/local/share/dotnet/sdk]
2.0.3 [/usr/local/share/dotnet/sdk]
2.1.4 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
Microsoft.NETCore.App 1.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 1.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

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

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

@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!

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.

I'm using VS remote Containers, which opens a workspace. There are 3 slns in the directory. I open the one that links to the right project.

Intellisense doesn't work.

Here's what's now showing up in the logs which makes no sense because it's running in docker on a linux container using the default.net core sdk dev container

    Failed to load project file '<xyz>'.

xyz.csproj
/usr/share/dotnet/sdk/3.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): Error: The "ResolvePackageAssets" task failed unexpectedly.
NuGet.Packaging.Core.PackagingException: Unable to find fallback package folder 'C:\Microsoft\Xamarin\NuGet\'.
at NuGet.Packaging.FallbackPackagePathResolver..ctor (System.String userPackageFolder, System.Collections.Generic.IEnumerable1[T] fallbackPackageFolders) [0x00064] in <7f3045eebb294003b90b7fd9061c946c>:0 at Microsoft.NET.Build.Tasks.NuGetPackageResolver..ctor (System.String userPackageFolder, System.Collections.Generic.IEnumerable1[T] fallbackPackageFolders) [0x00006] in <4f60ba738837484e89812ce739ac660a>:0
at Microsoft.NET.Build.Tasks.NuGetPackageResolver.CreateResolver (System.Collections.Generic.IEnumerable`1[T] packageFolders) [0x00018] in <4f60ba738837484e89812ce739ac660a>:0
at Microsoft.NET.Build.Tasks.NuGetPackageResolver.CreateResolver (NuGet.ProjectModel.LockFile lockFile) [0x0002a] in <4f60ba738837484e89812ce739ac660a>:0
at Microsoft.NET.Build.Tasks.ResolvePackageAssets+CacheWriter..ctor (Microsoft.NET.Build.Tasks.ResolvePackageAssets task) [0x00035] in <4f60ba738837484e89812ce739ac660a>:0
at Microsoft.NET.Build.Tasks.ResolvePackageAssets+CacheReader.CreateReaderFromDisk (Microsoft.NET.Build.Tasks.ResolvePackageAssets task, System.Byte[] settingsHash) [0x0003a] in <4f60ba738837484e89812ce739ac660a>:0
at Microsoft.NET.Build.Tasks.ResolvePackageAssets+CacheReader..ctor (Microsoft.NET.Build.Tasks.ResolvePackageAssets task) [0x00015] in <4f60ba738837484e89812ce739ac660a>:0
at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ReadItemGroups () [0x00000] in <4f60ba738837484e89812ce739ac660a>:0
at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ExecuteCore () [0x00018] in <4f60ba738837484e89812ce739ac660a>:0
at Microsoft.NET.Build.Tasks.TaskBase.Execute () [0x0002e] in <4f60ba738837484e89812ce739ac660a>:0
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in :0
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002a9] in :0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hamhub7 picture hamhub7  路  3Comments

tstivers1990 picture tstivers1990  路  3Comments

slevengood picture slevengood  路  3Comments

mattwoberts picture mattwoberts  路  3Comments

ghost picture ghost  路  3Comments