Missing part of code coverage

2024-02-08T19:54:42.3263679Z Task         : Run Code Analysis
2024-02-08T19:54:42.3263798Z Description  : Run scanner and upload the results to the SonarQube server.
2024-02-08T19:54:42.3263943Z Version      : 5.19.0
2024-02-08T19:54:42.6567533Z SonarScanner for MSBuild 5.15
2024-02-08T19:54:42.6570931Z Using the .NET Framework version of the Scanner for MSBuild

I have an old vb.net solution, over the time, I added csharp test projects. The team decided that we need to cover the code we change with unit tests that are run in the build pipeline.
Recently, it was decided that all our build pipeline would include Sonarqube reporting to show the managers that we improve code quality.

We have Sonarqube Enterprise EditionVersion 9.9.1 (build 69595) and AzureDevops on premise (can’t find the version). The build agent runs visual studio 2022 enterprise runtime.

During the process of implementing some new changes in the code, I noticed that the code coverage for the new code is not seen in Sonarqube. From the build pipeling, I have
retreived the code coverage file and manually checked the coverage using Visual Studio 2022. My new code was fully covered. In that PR, I have modified 20 files, some in VB.NET and some in C#.
Of the 200 files, 3 are marked with a score of 100% code coverage. Why are some files fully covered and other not?

After searching through the Sonarque community forums, I noticed this was a reccurent issue but nothing seems to fit my details. Using what I gathered, I added the sonar.verbose=true in my
SonaqubePrepare task parameters. In the SonarqubeAnalysis task log, I noticed that my files are excluded but I can’t figure out why: The message is :

DEBUG: Did not find deterministic source path in ‘D:\Work\4\s\Sources\AvancerSolutions\AvancementSolutions.vb’. Will skip this coverage entry. Verify sonar.sources in .sonarqube\out\sonar-project.properties.

What can I do to figure out why I have this issue? And how to fix it?

I have tried to force deterministic source path with -p:DeterministicSourcePaths=true in my msbuild task parameters but impossible to build with that parameter. So I hope this is not necessary.

Hi,

Welcome to the community!

I need to start with the dumb question: Does AvancementSolutions.vb exist at that path?

And could you provide the debug log you’ve generated? Starting from the begin command, hopefully.

 
Thx,
Ann

The path is correct. The generated log contains 20551 lines, so I wonder if I should publish the whole thing here.

That being said, I don’t see a “begin” command (or keyword) in the log file. I have downloaded the log file from my AzureDevOps build pipeline run.

Hi,

Let’s back up to how you’re analyzing. Are you using the SonarScanner for .NET?

 
Ann

The build server is offering SonarScanner for MSBuild 5.15, as I have shown in the log extract.

The SonarScanner for .NET have not been installed, from what I gather.