SonarQube showing Roslyn errors that are disabled in .editorconfig file

SonarQube version 9.5.0.56709

After setting up SonarQube for our .NET Framework 4.8 projects there are number of Roslyn analyzer code smell errors that are appearing within SonarQube. The roslyn errors that appear are related to StyleCop. For instance SA1101 ‘Prefix local calls with this’.

These issues do not appear inside Visual Studio as our solution files (.sln) contain our .editorconfig file. In addition to the editor config files we also have the following NuGet packages installed:

  • StyleCop.Analyzers → v1.2.0-beta.435 (beta is in use in order to apply newer rules)
  • StyleCop.Analyzers.Unstable → v1.2.0.435

Are you able to provide any information that would help us get SonarQube respecting the editorconfig rules or alternatively stop the Roslyn issues appearing in SonarQube?

For reference the example code smell SA1101 is marked as disabled in our editorconfig file


Yet we still see 13k code smell errors in SonarQube

What we have tried:

  • Changing the projects Properties > Code Analysis rule set from the below ‘Microsoft Managed Recommended Rules’ to a custom ruleset that mimics the editorconfig rules

Hey there.

SonarQube is only going to read in the Roslyn warnings emitted during your build step – if they’re emitted there (and for the sake of isolating the issue, without SonarQube or Visual Studio in the picture, just your dotnet build or MSBuild.exe step, preferably in your CI environment), you should focus there.

You can configure behavior around the import of Roslyn issues overall in your Administration / Project Settings > General Settings > External Analzyers > C#