Hi,
in my dotnet project I have a problem with the code analysis.
By running the analysis with the old SonarScanner for MSBuild 4.5, all C# source code are analyzed correctly and reported in Sonarqube (2 subfolder, 624 classes)
By running the analysis with the new SonarScanner for MSBuild 4.6.2, only a subset of the C# source code are analyzed, (15 classes)
On the Code view of the project, I see that only 1 subfolder is reporting Lines of Code (the 15 classes),
the big part of the code present on the other subfolder is completely not present
The build process is done with a CICD pipeline with Jenkins, the code is not changed, we just update the SonarScanner for MSBuild
Out of interest: why did you upgrade to v4.6.2 rather than to the latest version of the scanner?
The only change I can think of between v4.5 and v4.6.2 that could have resulted in fewer projects being analyzed is S4MSB-651, which would result in XUnit projects being correctly identified as test projects, and not analysed. However, it sounds like you have too much missing code for that to account for all of it.
Some questions:
have you tried reverting back to v4.5 of the scanner?
ave there been any changes to the Jenkins pipeline?
are there any warnings in the MSBuild or scanner end steps?
how many projects are not being analyzed now, and what types of project are they? (e.g. class libraries, test projects etc)
Hi Duncan,
we update the server last year in December to 7.9.1 and on that moment the v4.6.2 was the last updated version of the scanner.
Yes, I did the tests yesterday with 4.6.2 and 4.5, the reported value are the result of this 2 tests.
I read the issue you mentioned, I have the other effect, a non test project seems to recognize as a test project and not analyzed.
is it possible to set
I have remarked that on the missing analyzed folder, there are few test classes; could be this the problem?
On end step I found some WARN like
WARN: File 'C:\Users\svcpjenkins\AppData\Local\Temp\.NETFramework,Version=v4.7.1.AssemblyAttributes.cs' referenced by the protobuf 'TokenTypeInfo' does not exist in the analysis context
There are only few projects that have this effect, a large number of projects are working correctly.
I think there is something on that project that run on the problem
Bye Stefano
Hi Andrei,
no, unfortunately not.
I have to say that the developers didn’t have to much time to investigate the problem.
I did some modification, but with no effect. (I’m personally not a Dotnet developer…)
Bye Stefano