dgreenppt
(David Green)
May 16, 2023, 1:15pm
1
I am using SonarQube 9.9.0.65466 and I have a C# project integrated via Azure DevOps and a git repo. In this particular project, I have a Roslyn analyzer configured. One of the rules, CS1591, I have configured via the dotnet build /nowarn command switch so the rule (XML comments) will be ignored. If you review the output of the build step from dotnet build, the rule is not processed and does not appear as a warning. However, within SonarQube, there are issues created for each instance (and a comment applied to the PR), despite the fact that the build suppressed the warning and it did not appear in the output of the build. Is there a way that I can get this rule suppressed within SonarQube?
Colin
(Colin)
May 17, 2023, 9:14am
2
Hey there.
I found this GitHub issue while researching the problem.
opened 06:04PM - 28 Sep 18 UTC
closed 05:02PM - 24 Jul 19 UTC
Needs More Info
## Environment data
`dotnet --info` output:
```
.NET Core SDK (reflecting a… ny global.json):
Version: 2.1.402
Commit: 3599f217f4
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.402\
Host (useful for support):
Version: 2.1.4
Commit: 85255dde3e
.NET Core SDKs installed:
1.0.4 [C:\Program Files\dotnet\sdk]
1.1.10 [C:\Program Files\dotnet\sdk]
2.1.2 [C:\Program Files\dotnet\sdk]
2.1.4 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.400 [C:\Program Files\dotnet\sdk]
2.1.401 [C:\Program Files\dotnet\sdk]
2.1.402 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
```
VS Code version: 1.27.2
C# Extension version: 1.16.1
## Steps to reproduce
1. Create new C# project.
2. Add the following to the csproj file:
```
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>
```
3. Open the Problems pane, if not already open.
4. Build the project.
3. Note that "Missing XML comment" warnings appear in the Problems pane, despite CS1591 being ignored in the csproj file.
4. Build the project and read the build log.
## Expected behavior
"Missing XML comment" warnings do not appear, either in the Problems pane or the build log for the project.
## Actual behavior
The Problems pane lists "Missing XML comment for..." warnings, despite CS1591 being included in the NoWarn list. (Build log is as expected.)
Do you have some .ruleset
configuration turning this rule on? What version of Visual Studio / DotNet are you using?
That’s very odd, as there’s no other way for SonarQube to know about the issue other than the build output.
dgreenppt
(David Green)
May 18, 2023, 1:42pm
3
We had an .editorconfig file entry to lower it from warning to suggestion. Even when I removed and re-analysed it, it still reports these issues in SonarQube. I also tried to delete the branch in SonarQube and re-process it, but the XML issues still appear. The build output from MSBuild doesn’t show any output related to this warning at all.