dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.87k stars 675 forks source link

Problems view reporting incorrect errors, Mac #3764

Open mark-feeney-sage opened 4 years ago

mark-feeney-sage commented 4 years ago

Issue Type: Bug

A recurring issue with this extension is hundreds of false errors appearing in the Problems view making it unusable. These are errors not reported when building from the dotnet cli. This is on a MacBook Pro, Mojave. There doesn't seem to be any consistent pattern of error being raised, but at the moment it is a "The type or namespace name XYZ could not be found (are you missing a using directive or an assembly reference?)". There are other errors at other times (ambiguous member names in classes for example).

Reloading Omnisharp seems to resolve it temporarily, but the view is useless for spotting real errors.

It may be worth mentioning that this is repo has a large number of assembly projects (100+), most of them .NET Core 3.1.

Extension version: 1.21.18 VS Code version: Code 1.44.2 (ff915844119ce9485abfe8aa9076ec76b5300ddd, 2020-04-16T17:07:18.473Z) OS version: Darwin x64 18.7.0

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz (8 x 2900)| |GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled| |Load (avg)|3, 3, 4| |Memory (System)|16.00GB (0.79GB free)| |Process Argv|.| |Screen Reader|no| |VM|0%|
JoeRobich commented 4 years ago

@mark-feeney-sage Can you share the Omnisharp Log for the Output pane the next time you get into this state. It would help us identify why you are seeing these errors.

mark-feeney-sage commented 4 years ago

Sorry, yet to catch the logs around the point of it happening. That is, before restarting Omnisharp which has to be done frequently. What seems to be happening is that, when refactoring project names and namespace names extensively, the Problems pane is not refreshing correctly in line with actual changes and builds. So dotnet build is showing success while Omnisharp still lists namespace-not-found errors.

mark-feeney-sage commented 4 years ago

Here are some logs that may be significant:

[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.CodeAnalysis.CSharp.Features.resources, Version=3.6.0.0, Culture=en-IE, PublicKeyToken=31bf3856ad364e35'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        FAILURE: Could not locate '/Users/mark.feeney/.vscode/extensions/ms-dotnettools.csharp-1.21.18/.omnisharp/1.35.1/omnisharp/.msbuild/Current/Bin/Microsoft.CodeAnalysis.CSharp.Features.resources.dll'.
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Attempting to resolve 'Microsoft.CodeAnalysis.CSharp.Features.resources, Version=3.6.0.0, Culture=en, PublicKeyToken=31bf3856ad364e35'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        FAILURE: Could not locate '/Users/mark.feeney/.vscode/extensions/ms-dotnettools.csharp-1.21.18/.omnisharp/1.35.1/omnisharp/.msbuild/Current/Bin/Microsoft.CodeAnalysis.CSharp.Features.resources.dll'.
[dbug]: OmniSharp.Stdio.Host
        ************  Response ************
{
  "Request_seq": 128898,
  "Command": "/v2/getcodeactions",

@JoeRobich , is there a private channel I can post my logs to? I have some now. I see a lot of info in them that I don't want publicly accessible.

trackingallday commented 4 years ago

I am also experiencing this issue: Mojave 10.14.6

Using vscode + opening project in a dev container - using dotnetcore 3.1

Omnisharp logs show the standard logs even when it is effectively in a useless state

benjamincburns commented 3 years ago

Experiencing this issue as well under VSCode on Win 10 while using the Remote WSL extension. I doubt the problem is platform-specific, however. Project is a solution with two basic .NET core library projects and an ASP.NET Core 5.0 project.

It seems that using VS Code's inbuilt refactoring features (e.g. rename a class, class member, file, etc) seem to trigger it, but I also get it at other times. It forces me to restart OmniSharp frequently, which is frustrating and takes a while. If there was a viable alternative to OmniSharp at this stage I'd likely use that.