Environment:
Enterprise Edition Version 8.9.6 (build 50800)
Processing plugin: csharp version 8.22.0.31243
Scanner: SonarScanner for MSBuild 4.10
using SonarScanner 4.4.0.2170
using Java 11.0.9.1 AdoptOpenJDK (64-bit)
using Windows 10 10.0 amd64
Problem:
When trying to analyze unit test code (<SonarQubeTestProject>false</SonarQubeTestProject>) the analysis finds all files (*.cs) as it should, however the LoC displayed in the Web Frontend are wrong and hence not counted for the statistic/dashboard.
Example test file: LoC is displayed as “—” (first column)
If I navigate into the file itself the LoC seem to work, I see 36 LoC counted for this file and displayed in the header. Also all issues are identified as expected.
The following scanner properties are set in order to care only for the unit test code, works as expected:
<Property Name="sonar.inclusions">**.Test**,**.UnitTests**</Property>
<Property Name="sonar.exclusions">**/AssemblyInfo.cs,**/Disposable*Base.cs,**/*.Generated.cs,**/GeneratedImplementation.cs,**/*.Designer.cs</Property>
Also the scanner log seems ok:
Sonar: (...UnitTests.csproj) Categorizing project as test or product code...
Sonar: (...UnitTests.csproj) SonarQubeTestProject has been set explicitly to false
Sonar: (...UnitTests.csproj) Project categorized. SonarQubeTestProject=false
PS: I was not able to upload more images because your server won’t let me, response is always that uploading did not work out, should try again.