-
Notifications
You must be signed in to change notification settings - Fork 676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enabling 'Roslyn Analyzers' prevents OmniSharp project-wide error reporting / resolution #4754
Comments
Same thing is happening to me in a Unity project. I deleted a namespace expecting every script that used it to go red, but they don't do it until I open them and either modify or save the file. Also a mix of these errors appear in the Output:
Also, enabling or disabling "Roslyn Analyzers" option does nothing, I have this error since I made the project. I'm using the latest version of the Visual Studio Code unity extension and reset solution and projects multiple times. |
I've seen this as well, with Unity projects! This specific instance I used as an example was a native C# project and curiously it didn't appear in the log. |
Found something. Up until now I had been turning on and off Roslyn analyzers with the settings toggle: Tinkering around today, I found the file that @yoshi45111 talks about in the OP (omnisharp.json) and I noticed that, in the file, Turns out that the toggle only modify the line Not only that, but I found why it was turned on in the first place. "EnableAnalyzersSupport": true,
"LocationPaths": [
"c:/Users/[Username]/.vscode/extensions/josefpihrt-vscode.roslynator-3.2.2/roslyn/common",
"c:/Users/[Username]/.vscode/extensions/josefpihrt-vscode.roslynator-3.2.2/roslyn/analyzers",
"c:/Users/[Username]/.vscode/extensions/josefpihrt-vscode.roslynator-3.2.2/roslyn/refactorings",
"c:/Users/[Username]/.vscode/extensions/josefpihrt-vscode.roslynator-3.2.2/roslyn/fixes"
] Even when you uninstall the extension, these changes remain, which is why this value changed for me even tho I have never handled omnisharp.json directly. And that's it. Mystery solved. At least for me lol. For anyone looking for omnisharp.json it's in |
This does bring back project-wide error reporting for me, though ideally I would like to keep the Roslynator analyzers AND project-wide reporting. It seems to be one or the other at present unfortunately! |
I can confirm this issue exists, both on Windows (11) and Linux (Fedora 35). I think the expected behaviour would be to leave Solution wide error reporting enabled and have Roslyn analyzers enabled at the same time, thus also showing all the warnings, informations etc. that the Roslyn analyzer produces for the entire project and not just for the opened file(s). |
Also happening in vscode 1.63.2 (c# extension v1.23.17) with .net core 3.1 |
Any news for this issue? |
The issue is still present with version ms-dotnettools.csharp-1.25.0-linux-x64 .NET 6.0.108. When setting The log is filled with messages like this one : |
Any news? |
Having the same issue on vscode 1.77.3. (c# extension v1.25.4, .net sdk 6) |
Environment data
.NET info:
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19042
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.400\
Host (useful for support):
Version: 5.0.9
Commit: 208e377a53
.NET SDKs installed:
5.0.400 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
VS Code version:
Version: 1.60.0 (user setup)
Commit: e7d7e9a9348e6a8cc8c03f877d39cb72e5dfb1ff
Date: 2021-09-01T10:41:52.311Z
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19042
C# Extension version: v1.23.15
OmniSharp log
OmniSharp Log
Starting OmniSharp server at 2021-09-09, 1:49:41 p.m.
Target: c:\Users-\Test
OmniSharp server started.
Path: c:\Users.vscode\extensions\ms-dotnettools.csharp-1.23.15.omnisharp\1.37.15\OmniSharp.exe
PID: 11552
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 17.0.0 - "c:\Users.vscode\extensions\ms-dotnettools.csharp-1.23.15.omnisharp\1.37.15.msbuild\Current\Bin"
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to 'c:\Users.vscode\extensions\ms-dotnettools.csharp-1.23.15.omnisharp\1.37.15.msbuild\Current\Bin\MSBuild.exe'
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 17.0.0 - "c:\Users.vscode\extensions\ms-dotnettools.csharp-1.23.15.omnisharp\1.37.15.msbuild\Current\Bin"
CscToolExe = csc.exe
CscToolPath = c:\Users-.vscode\extensions\ms-dotnettools.csharp-1.23.15.omnisharp\1.37.15.msbuild\Current\Bin\Roslyn
MSBuildExtensionsPath = c:\Users.vscode\extensions\ms-dotnettools.csharp-1.23.15.omnisharp\1.37.15.msbuild
MSBuildToolsPath = c:\Users.vscode\extensions\ms-dotnettools.csharp-1.23.15.omnisharp\1.37.15.msbuild\Current\Bin
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
info: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in 'c:\Users\Test'.
info: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
info: OmniSharp.MSBuild.ProjectSystem
No solution files found in 'c:\Users\Test'
info: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\Users\Test\Test.csproj'
info: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'c:\Users\Test'.
info: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
info: OmniSharp.WorkspaceInitializer
Configuration finished.
info: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location 'c:\Users\Test' on host 5208.
info: OmniSharp.MSBuild.ProjectManager
Loading project: c:\Users\Test\Test.csproj
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\Users\Test\Test.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Adding project 'c:\Users\Test\Test.csproj'
info: OmniSharp.MSBuild.ProjectManager
Update project: Test
info: OmniSharp.Roslyn.CSharp.Services.Diagnostics.CSharpDiagnosticWorkerWithAnalyzers
Solution initialized -> queue all documents for code analysis. Initial document count: 4.
Steps to reproduce
Install VS Code and its C# extension
Enable "Roslyn Analyzers" under VS Code's OmniSharp settings
OR in the OmniSharp.json
Create a new C# project either externally or through a .NET terminal
Have multiple files defined in the project
Have references to fields, variables or methods in another file than the one they originate in
Expected behavior
Changing fields in one file should propagate to connected files and reflect the change in the editor automatically, in real-time.
e.g. Removing a constant variable used in another file should subsequently produce an error automatically in the "Problems" pane
This is the behaviour when "Roslyn Analyzers is disabled, the editor detects and resolves issues in real time
Actual behavior
Changing, deleting or modifying a field does not update the other open files in the editor, and will not respond to the change unless the affected file is selected and modified, as seen here:
The editor does not detect an error UNTIL the affected file is updated:
The editor does not resolve the error UNTIL the affected file is, again, updated:
The text was updated successfully, but these errors were encountered: