org.sonar.plugins.dotnet.tests.ParseErrorException: Missing root element <CoverageSession>

1,072 views
Skip to first unread message

tre...@gmail.com

unread,
Mar 27, 2018, 6:41:21 AM3/27/18
to SonarQube
Hey,

I am trying to push csharp code coverage report data to sonarqube server using sonar.cs.opencover.reportsPaths="PathToMergedXmlReport"

The xml reports are generated by open cover and merged into a single report by report generator tool.

In the attached zip file (input+output.zip) I have zipped the input xml report (Summary.xml) and dull command line build output (output.txt).

Any thoughts how to solve my issue? Thanks!


00:07:09.453 INFO: Parsing the OpenCover report C:\jenkins\workspace\10.3.S_sonar_csharp\build\change-management\C#MergedReports\xml\Summary.xml
00:07:09.481 INFO: ------------------------------------------------------------------------
00:07:09.481 INFO: EXECUTION FAILURE
00:07:09.481 INFO: ------------------------------------------------------------------------
00:07:09.481 INFO: Total time: 1:29.775s
00:07:09.640 ERROR: Error during SonarQube Scanner execution
org.sonar.plugins.dotnet.tests.ParseErrorException: Missing root element <CoverageSession> in C:\jenkins\workspace\10.3.S_sonar_csharp\build\change-management\C#MergedReports\xml\Summary.xml at line 2
at org.sonar.plugins.dotnet.tests.XmlParserHelper.parseError(XmlParserHelper.java:154)
at org.sonar.plugins.dotnet.tests.XmlParserHelper.checkRootTag(XmlParserHelper.java:56)
at org.sonar.plugins.dotnet.tests.OpenCoverReportParser$Parser.parse(OpenCoverReportParser.java:54)
at org.sonar.plugins.dotnet.tests.OpenCoverReportParser.accept(OpenCoverReportParser.java:37)
at org.sonar.plugins.dotnet.tests.OpenCoverReportParser.accept(OpenCoverReportParser.java:30)
at org.sonar.plugins.dotnet.tests.CoverageCache.readCoverageFromCacheOrParse(CoverageCache.java:39)
at org.sonar.plugins.dotnet.tests.CoverageAggregator.aggregate(CoverageAggregator.java:115)
at org.sonar.plugins.dotnet.tests.CoverageAggregator.aggregate(CoverageAggregator.java:97)
at org.sonar.plugins.dotnet.tests.CoverageReportImportSensor.analyze(CoverageReportImportSensor.java:102)
at org.sonar.plugins.dotnet.tests.CoverageReportImportSensor.execute(CoverageReportImportSensor.java:98)
at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:73)
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:88)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:180)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:288)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:283)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:261)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:111)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
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:233)
at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:123)
at org.sonarsource.scanner.cli.Main.execute(Main.java:77)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
00:07:09.641 ERROR: 
00:07:09.641 ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
00:07:09.639 INFO: Final Memory: 52M/531M
00:07:09.640 INFO: ------------------------------------------------------------------------
00:07:09.641 DEBUG: Execution getVersion
00:07:09.642 DEBUG: Execution stop
Process returned exit code 1
00:07:09.85  Creating a summary markdown file...
The SonarQube Scanner did not complete successfully
00:07:09.859  Post-processing failed. Exit code: 1
input+output.zip

tre...@gmail.com

unread,
Mar 28, 2018, 4:53:11 AM3/28/18
to SonarQube
Looks like sonarqube does not support merged xml reports (by report generator). When I supplied the native open cover reports paths separated by commas, the error disappeared. 
The coverage however is missing on the server (cmd.zip). I am currently trying to figure out why... 
cmd.zip

Vassilena Treneva

unread,
Mar 28, 2018, 5:35:07 AM3/28/18
to SonarQube
I see a lot of messages like this one:

DEBUG: Code coverage will not be imported for the following file outside of SonarQube

Although I do not know why :) (yet)

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/0aUTwA2ufCA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/11b4ab93-d173-4f71-adde-9f67e3d932b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Amaury Leve

unread,
Apr 11, 2018, 11:12:51 AM4/11/18
to Vassilena Treneva, SonarQube
Hi Vassilena,

Regarding your first zip (input+output), the xml coverage report you included doesn't seem to be following the format we expect. I haven't used much OpenCover but when looking at tools parsing OpenCover results they all expect the same root as we do (i.e. CoverageSession). So I am not really sure whether we should be doing something.

Regarding the second zip (cmd), as you can see on line 468364, the base directory calculated for the analysis is C:\jenkins\workspace\10.3.S_sonar_csharp\prod\csharp\ and so every file not under this folder will be excluded.

Have I answered all of your questions?

Cheers,
Amaury

To unsubscribe from this group and all its topics, send an email to sonarqube+...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/CAG6hjyWGRjL0B42PXs7L8B578ZY%2B8KtaRuT6rsgyfi3iiM1O4w%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.
--

Amaury Levé | SonarSource

Software Developer - .Net Team

http://sonarsource.com


Are you using SonarLint in your IDE? 

tre...@gmail.com

unread,
Apr 12, 2018, 3:29:14 AM4/12/18
to SonarQube
Hi Amaury,

Yes, I figured that the merged report format is not supported so I reworked my setup.
After matching the paths, everything works! The problem in our case is that we have distributed VM landscape and XMLs are gathered from many machines and they could be published to sonarqube from any slave.

But I added additional processing of the paths  (pointing to sources/dlls, etc) in the XML files and it is all set now.  
Many thanks!
Reply all
Reply to author
Forward
0 new messages