Receiving "The Code Coverage report doesn't contain any coverage data for the included files." for .NET coverage

Using SonarScanner for MSBuild 4.7.1, SonarQube 7.7, csharp plugin 7.16.0.8981

Attempting to report code coverage for a .NET project. I generate the report with vstest, then convert it to the .coveragexml format, and pass it to SonarQube. Using GitLab artifacts, I am able to see that the file is generated. However, I see the following output:

21:06:07.140 INFO: Adding this code coverage report to the cache for later reuse: ...\my.coveragexml
21:06:07.151 WARN: The Code Coverage report doesn't contain any coverage data for the included files. For troubleshooting hints, please refer to https://docs.sonarqube.org/x/CoBh

The link that is referenced is dead. The only thing I see suggested online is setting DebugType to full, however this did not work for me either. The steps we are executing are templated out such that I can duplicate them in other projects; of three .NET projects that I have, one reports coverage fine and two do not.

hi @knueser and welcome to our community

Did you check the contents of the ...\my.coveragexml file ? does it contain anything?

Also, did you read the Code Coverage is not shown in the SonarCloud.io topic? Could you follow the advice given there to diagnose your problem?

You can also read this answer for more info and tips here.

To be able to help you, we need the verbose logs of the END step. You can turn on the verbose output of the command (please run SonarScanner.MSBuild.exe begin /k:“MyProject” /d:sonar.verbose=true as the begin step). That is, add the /d:sonar.verbose=true parameter to the command.

Thanks, I found the log statement in our code and will update it.

Hey Andrei, thanks for getting back.

  1. The coverage XML file contains what looks like normal coverage data. I tried comparing it to the project that is working and didn’t notice anything out of the ordinary. However, one avenue I was pursuing yesterday is the fact that my Domain module is not included in the coverage XML, which leads me to suspect a problem with the project configuration, although I could not find anything that would cause this to happen.

  2. I read through that post which got me to take a closer look at the logs, one thing I notice is that everything in my WebUI module appears to be interpreted as tests, which is definitely suspicious. I know that the Sonar Scanner is supposed to automatically detect the difference between the sources and tests because if I specify those properties the scan errors out.

Would it be possible to send the detailed logs and other relevant files to you directly?

For the community - we have a discussion on a private thread based on the logs.

Later edit: check our wiki Analysis of product projects vs. test projects - project categorisation to see if one of those cases apply.

Also see C# classes no more in code analysis scope - they had a similar problem.

For the community - the problem was the following (mentioned in the wiki)

  • the project file contains the legacy Service GUID {82A7F48D-3B50-4B1E-B82E-3ADA8210C358} that is added by the Test Explorer to mark a project as a containing tests
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.