java.lang.IllegalStateException: Line 588 is out of range in the file

ant
coverage
csharp
sonarqube

(vazzilena) #1

Hey,

Any idea why my csharp build would fail like this:

INFO: Adding this code coverage report to the cache for later reuse: C:\jenkins\workspace\10.3.S_sonar_csharp\build\change-management\remote-opencovers\xml\home\nirdevadm\10.3\opencover\OpenCoverResultsCluster.xml
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:38.041s
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Line 588 is out of range in the file client-admin/nAdminAPI/nInterface.cs (lines: 587)
	at org.sonar.api.internal.google.common.base.Preconditions.checkState(Preconditions.java:197)
	at org.sonar.api.batch.sensor.coverage.internal.DefaultCoverage.validateLine(DefaultCoverage.java:93)
	at org.sonar.api.batch.sensor.coverage.internal.DefaultCoverage.lineHits(DefaultCoverage.java:81)
	at org.sonar.plugins.dotnet.tests.CoverageReportImportSensor.analyze(CoverageReportImportSensor.java:109)
	at org.sonar.plugins.dotnet.tests.CoverageReportImportSensor.execute(CoverageReportImportSensor.java:79)
	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:182)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
INFO: Final Memory: 52M/576M	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)

	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:312)
INFO: ------------------------------------------------------------------------
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:307)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:281)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
	at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
	at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:81)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
	at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:132)
	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)
ERROR: 
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
09:24:02.219  Creating a summary markdown file...
The SonarQube Scanner did not complete successfully

EDIT: just came across this topic:

It suggests that if you pull outdated coverage data and you have changes in the source file you might run into this issue. But It does not make sense in my case because I am pulling old coverage data but the source file on which is fails has no changes at all (nInterface.cs).

Weird…


(Nicolas Bontoux) #2

Hi there,

When it comes to coverage data, I believe that the fact that the file changed or not is of little importance. SonarQube imports the latest coverage data, irrespective of file changes (think of an edit on tests, which can change coverage on files which weren’t modified).

Hence the importance of coverage data correspond precisely to the sources analyzed, as explained here: