dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 672 forks source link

Build errors in VSCode appear twice #3997

Open crispyricepc opened 4 years ago

crispyricepc commented 4 years ago

Environment data

.NET Core SDK (reflecting any global.json):
 Version:   3.1.201     
 Commit:    b1768b4ae7  

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

Host (useful for support):
  Version: 3.1.3
  Commit:  4a9f85e9f8

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

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

Steps to reproduce

Create a new dotnet core project using dotnet new console Select yes to generate tasks.json and launch.json defaults Remove the semicolon in the auto-generated Hello World code Run the build task

Expected behavior

Only one CS1002 error saying "; expected"

Actual behavior

Two CS1002 errors pointing to the same line, one with an included full path, another without one

Screenshots

Demo

cartermp commented 4 years ago

This is an issue with the editor and the build task generated for debugging yielding back the same error. We could investigate if there is a not-too-complicated way to de-duplicate things, or just not have the build task also yield back errors.

crispyricepc commented 4 years ago

This is an issue with the editor and the build task generated for debugging yielding back the same error. We could investigate if there is a not-too-complicated way to de-duplicate things, or just not have the build task also yield back errors.

Perhaps a quick suggestion on how it could be fixed. The problems panel could check to see whether identical error codes appear at the same coordinates and ensure to only show one of them?

cartermp commented 4 years ago

It'll bear some investigation. One of the issues is that activities in the editor and activities that invoke build are completely orthogonal. In Visual Studio, this massively complicates things (i.e., diagnostics could be coming from different threads and processes), leading to some problems and sometimes "sticky" errors. We're not sure if those same kinds of problems are relevant here or not.

JoeRobich commented 4 years ago

@CRISPYricePC For a workaround, in your .vscode/tasks.json, replace "problemMatcher": "$mscompile" with "problemMatcher": [].

Scal-Human commented 4 months ago

This is not a VSCode or panel issue, messages are duplicated with a dotnet build on command line also, always.