Incorrect Code Coverage: xunit


I encountered an issue with the code coverage reported by sonarqube. The xunit code coverage for one file is 91% but the coverage reported by sonarqube for the same file is only 40%. I’m not sure what is causing this issue, any help would be appreciated.

Thank you

hi @dani123 and apologies for the delay

We need more details , the verbose output of the END command (please run SonarScanner.MSBuild.exe begin /k:"MyProject" /d:sonar.verbose=true as the begin step, and please attach the output of END step).


  • what is the version of SQ?
  • what is the version of MSBuild you are using?

Can you share the code with us , or a small reproducer project?

The version of SQ is 8.1
The version of MSBuild is 4.9

When running a test from a Linux container, this warning message can be seen:

But when running from a Windows container this is seen:

We suspect the incorrect code coverage to be a consequence of the code coverage not being supported on linux.

From what I can see, this is a problem with the code coverage tool and not with our product, right?

I believe that to be the case. As i understand it, SonarQube only displays the results of the code coverage tool therefore the issue is unrelated to your product.

That’s correct.

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