Windows 11
Visual Studio 2022 17.14.0
SonarAnalyzer.CSharp 10.9.0.115408 as nuget package
I’m having problems with the errors of SonarAnalyzer.CSharp not showing in the editor, the errors also are not shown in the Error List Window unless I change the output to “Build Only”, I don’t have the Lint (never have) and “Show error squiggles” is enabled.
I don’t know what another configuration I should check, I haven’t installed any extension, just upgrading package versions and VS.
It’s kind of annoying mainly because my flow is basically edit some code adding variables to see the values while debugging, these variables trigger some S1481 errors and I just Ctrl+. in the error and ignore it in source code to run my changes.
The only errors not shown in the editor are the one from SonarAnalyzer.CSharp, errors from StyleCop, Rosylnator or the default analyzers are visible.
To be clear, you have not installed SonarQube for Visual Studio (SonarLint’s new name). Instead you have manually downloaded the Nuget package? And expect it to raise issues in your IDE?
For that you’re going to need to go whole-hog and install SonarQube for Visual Studio.
Something changed? Like I said I never installed SonarQube for Visual Studio as an extension, just the package, with that I could see the errors from SonarAnalyzer.CSharp in the editor with the file open.
For what is worth this is my configuration regarding Analyzers
Right now, we are only using SonarCloud during merge, in PR’s we decided to use only the nuget packages because Sonar changes the configuration of TreatWarningsAsErrors to false during a build, with that someone could edit a file in an online editor, declare a variable that it was never used and the PR would not fail because it is only a warning and merge the PR, someone else downloads the code in VS and the build would fail because of this warning.
How can we enforce there no one can add Sonar issues in the PR if the extension only runs on VS?
If we add SonarQube to our PR’s we are in the same position, we could see the issue in the portal but the bad code its already in the repo.
Thanks
Edit: Also, we had some performance issues with some rules, so we disabled some of them in a .analyzerconfig file (in fact we have several .analyzerconfig files, some configure the rules for regular projects, other are for rules for unit test projects and sometimes another for rules were we run some performance analysis) that we have in the repo, the extension can pick up this file? or every developer has to manually change the configuration of the extension?
But the PR Analysis does not block the merge if there are quality issues, someone by mistake or trying to cheat the system could approve the PR and merge and those issues into the branch