Null-Pointer exception while parsing Visual Studio coverage report

  • Versions used: SonarCloud, is it always the latest version?

While parsing the VSTest coverage XML file, there is an unchecked scenario when the ranges are reporting covered state only in one category “yes/partial” or “no”.

I can share more details in PM if necessary.

<range source_id="157" covered="yes" start_line="23" start_column="0" end_line="23" end_column="0" />
<source_file id="157" path="C:\PathTo\File.cpp" checksum_type="MD5" checksum="B1271FD2FCD79571ACAEBE94BC005B04">
					</source_file>
ERROR: Error during SonarScanner execution
java.lang.NullPointerException
        at com.sonar.cpp.plugin.visualstudio.VisualStudioCoverageParser.handleSourceFileTag(VisualStudioCoverageParser.java:80)
        at com.sonar.cpp.plugin.visualstudio.VisualStudioCoverageParser.dispatchTags(VisualStudioCoverageParser.java:47)
        at com.sonar.cpp.plugin.visualstudio.VisualStudioCoverageParser.parse(VisualStudioCoverageParser.java:35)
        at com.sonar.cpp.plugin.visualstudio.VisualStudioCoverageParser.parse(VisualStudioCoverageParser.java:17)
        at com.sonar.cpp.plugin.visualstudio.VisualStudioCoverageSensor.execute(VisualStudioCoverageSensor.java:57)
        at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:45)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:75)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:48)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:66)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:48)
        at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:68)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
        at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:438)
        at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:434)
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:392)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
        at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:126)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
        at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:58)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
        at com.sun.proxy.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
        at org.sonarsource.scanner.cli.Main.main(Main.java:61)

Hi @danmunteanu,

I sent you a PM where you can share the report.

Hi @danmunteanu,

thank you for the report and the help, ticket created and fix on the way: https://jira.sonarsource.com/browse/CPP-2850.

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