Parsing code coverage failed


I’m trying to add the code coverage information for my c project (with c++ unit tests) to SonarCloud.

I have generated the coverage file with vstest.console, and used sonar.cfamily.vscoveragexml.reportsPath=**/*.coverage to specify it.

But when it comes to SonarCloud analysis I received an error:

Parsing D:\a_temp\TestResults\9ff5b1c8-7b74-429f-a390-e9f6d4173b16\VssAdministrator_WIN-A5JVBG8MS1P 2020-04-27 20_32_40.coverage

##[error]ERROR: Error during SonarQube Scanner execution
##[error]java.lang.RuntimeException: com.ctc.wstx.exc.WstxIOException: Input length = 1

Thanks for any helps!

Hi @dolphinm083,

you shouldn’t feed *.coverage reports to the analyzer, it expects the xml report, see C/C++/Objective-C / Coverage / Visual Studio Reports section: [Coverage & Test Data] Generate Reports for Apex, C/C++, Objective-C, Go, JS/TS and Python

Hi Massimo,

Thanks for the information.

I have followed the instruction and used the codecoverage.exe visual studio test platform to convert the .coverage file to .xml file.

However, I found that the .xml file generated by the codecoverage.exe is empty. I’ve checked that the .coverage file generated by vstest.console is not empty. Do you have any idea about this?


Hi @dolphinm083,

I don’t know how to help you on that, are you getting any error from codecoverage.exe? Does it return with exit code 0?

Hi Massimo,

Thanks for your reply and I didn’t receive any error from codecoverage.exe. It executed successfully and generated the xml but just empty.

Hi @dolphinm083,

then perhaps there is no information in the .coverage file, I invite you to check that every step produce the correct data.