vscode-csharp: Intellisense out of sync

Issue Description

I frequently get a situation where Intellisense is out of sync, even though builds are successful. Restarting Omnisharp usually resolve this, though sometimes restarting VS Code is required.

Steps to Reproduce

Unknown at this time.

Performing package restore (dotnet restore) and/or building (dotnet build) does not resolve the issue, regardless of where they’re done from (Code task, Code internal terminal, external terminal, etc.).

Expected Behavior

Intellisense matches known type information.

Actual Behavior

Intellisense shows unexpected errors with type information:

Screenshot from 2019-03-20 10-46-22

Logs

OmniSharp log

Starting OmniSharp server at 3/20/2019, 10:31:31 AM
    Target: /home/brad/src/appcenter/appcenter/samples/netcore-api/NetCoreApi.sln

OmniSharp server started with Mono 5.18.1.
    Path: /home/brad/.vscode/extensions/ms-vscode.csharp-1.17.1/.omnisharp/1.32.8/omnisharp/OmniSharp.exe
    PID: 12109

[warn]: OmniSharp.MSBuild.ProjectManager
        Unable to resolve assembly '/home/brad/src/appcenter/appcenter/samples/netcore-api/src/bin/Debug/netcoreapp2.2/NetCoreApi.dll'

C# log

This log is empty.

Environment information

VSCode version: 1.32.3 C# Extension: 1.17.1

Mono Information OmniSharp using global mono :5.18.1
Dotnet Information .NET Core SDK (reflecting any global.json): Version: 2.2.105 Commit: 7cecb35b92

Runtime Environment: OS Name: ubuntu OS Version: 18.10 OS Platform: Linux RID: ubuntu.18.10-x64 Base Path: /usr/share/dotnet/sdk/2.2.105/

Host (useful for support): Version: 2.2.3 Commit: 6b8ad509b6

.NET Core SDKs installed: 2.2.105 [/usr/share/dotnet/sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.2.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.2.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.2.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

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

Visual Studio Code Extensions
Extension Author Version
azure-pipelines ms-azure-devops 1.147.2
chat karigari 0.12.0
code-settings-sync Shan 3.2.7
code-spell-checker streetsidesoftware 1.6.10
csharp ms-vscode 1.17.1
dotnet-test-explorer formulahendry 0.6.5
EditorConfig EditorConfig 0.13.0
github-plus-theme thenikso 1.2.0
gitlens eamodio 9.5.1
ilspy-vscode icsharpcode 0.7.5
material-icon-theme PKief 3.6.3
PowerShell ms-vscode 1.11.0
quokka-vscode WallabyJs 1.0.196
ruby rebornix 0.22.3
toggle-excluded-files eamodio 1.6.0
vscode-browser-preview auchenberg 0.4.0
vscode-docker PeterJausovec 0.6.1
vscode-kubernetes-tools ms-kubernetes-tools 0.1.18
vscode-typescript-tslint-plugin ms-vscode 1.0.0
vscode-versionlens pflannery 0.22.0
vscode-yaml redhat 0.3.0
vscodeintellicode VisualStudioExptTeam 1.1.4
vsliveshare ms-vsliveshare 0.3.1326
vsliveshare-audio ms-vsliveshare 0.1.48
vsliveshare-pack ms-vsliveshare 0.2.10

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 22
  • Comments: 18 (1 by maintainers)

Most upvoted comments

Yeah, that’s why I reported this bug, because on average I’m restarting Omnisharp upwards of 20x per day (and it’s a common complaint on my team).

I have the same issue multiple times per day. I usually “Reload Window” to get it back in shape, but it’s super annoying and time draining.

I experienced the same issues every day, some scenarios I have seen it include:

  • Renaming a code file and then renaming his class name in the same workspace, sometimes it shows duplicated intellisense (both the old class name is available along the new one), or the new class name cannot be resolved.

  • Changing a namespace name with Search and Replace, intellisense does not get updated with the new namespace.

  • Performing changes in another workspace in the same window or another VS Code window with a project that is a dependency of the current workspace most of the time intellisense does not catch up with the changes.

All of them get resolved via restarting Omnisharp, but it gets annoying, is time consuming, and it explodes when the number of workspaces and projects grows up.

Same issue experienced frequently, daily.

It seems to be even worse, when you use Remote-Containers with the container running all the time. Omnisharp claims that it cannot load projects while running dotnet build completes without problems.

It’s very annoying having to restart Omnisharp server so frequently.

My environment:

  • Windows 10
  • Docker Desktop 2.4.0.0
  • VS Code 1.50.1
  • VS Code Extension “C#” (ms-dotnettools.csharp) v1.23.4

A very simple example to reproduce the problem seems to be: create a new file and add a new class. Omnisharp doesn’t pick it up.

Same issue here, very annoying. I’ve resorted to building on the command line a lot since IntelliSense is useless without constant restarts.

Same issue here. VS Code 1.41.1, OmniSharp looks like version 6.2.9200.0. Switching projects via the project selector fixes it too (if you have more than one project in the workspace).

Lately it’s been happening to me multiple times per hour.

@bradwilson, that’s probably due to a problem with the Omnisharp server… It’s annoying, but if you go to the “Command Palette” (Ctrl-Shift-P) and restart Omnisharp you should have intellisense back to making sense again… 😉

I run into this multiple times a day and I’m a bit surprised this hasn’t been a priority to address.