dotnet / dotnet/vscode-csharp

Intellisense continues to highlight fixed/stale errors (only if they were in the last compile attempt)

Open
#3,892 4 comments 9 reactions 0 assignees View on GitHub
Needs Investigation OmniSharp Triaged
Dominant language
TypeScript
Stars
3.1k
Forks
737
Avg merge
17h 56m
Merged PRs (30d)
21

Description

## Issue Description ##

If the last time you compiled there was a programming error, you will continue to observe the red underline indicating an error until you compile again. This is inconsistent behavior with the real-time detection between compiles, and leads to a confusing state.

The phantom error will also remain in the 'problems' window and file sidebar until recompile, even if fixed. After a recompile, the error is removed from both 'problems' and intellisense.

The incorrect underline persists if omnisharp is restarted, as well as if the file is closed and re-opened. However, if VS Code window is reloaded, the stale underline goes away.

Comparatively, Intellisense red underlines work normally for errors that are introduced and fixed between compiles. (Automatic flag & unflag of error in real-time). It's not until the error is compiled that it becomes persistent until the next compile.

## Steps to Reproduce ##

0. (Starting from a clean, compilable code base)
1. Intentionally create an error, such as introducing a typo in the name of a class you are trying to instantiate.
2. F5 to attempt a debug -- compile fails due to the type not being able to be found
3. Click Abort to return to code
4. Observe red underline showing the error
5. Fix typo in class name
6. Red underline is still visible with type error, despite the error having been fixed [BUG]
7. Press F5 to attempt a second debug. Compile is OK and red underline now disappears.

## Expected Behavior ##

Intellisense red underlines reflects the current, real-time state of the code.

## Actual Behavior ##

Intellisense red underlines reflects an inconsistent state -- combining the errors (but not fixes) of the previous compile attempt plus additional any errors introduced since then. Since the errors update elsewhere, the developer expects the errors shown to be the current state of the code, and then spends time chasing after errors that are already fixed.

## Logs ##

### OmniSharp log ###
Post the output from Output-->OmniSharp log here

### C# log ###
Post the output from Output-->C# here

## Environment information ##

**VSCode version**: 1.46.1
**C# Extension**: 1.22.1

Mono Information
OmniSharp using built-in mono
Dotnet Information
.NET Core SDK (reflecting any global.json):
Version: 3.1.301
Commit: 7feb845744

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

Host (useful for support):
Version: 3.1.5
Commit: 65cd789777

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

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.19 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.19 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.19 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.5 [/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|
|---|---|---|
|codedox|wiggin77|1.3.1|
|csharp|ms-dotnettools|1.22.1|
|haxe-debug|vshaxe|1.2.3|
|haxe-extension-pack|vshaxe|1.3.0|
|haxe-hl|HaxeFoundation|1.1.0|
|hxcpp-debugger|vshaxe|1.2.4|
|svn-scm|johnstoncode|2.11.4|
|vshaxe|nadako|2.21.2|;

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.