We keep getting Sonar error complaining code line out of range. The error message is:
java.lang.IllegalStateException: Line 92 is out of range in the file xxxxx.cpp (lines: 90)
The code it complains on has only 90 lines, we don’t understand how Sonar would expect line 92. Our CI does not use any cache, all analysis are from clean checkout and clean build.
This error can be eliminated by adding some empty lines in the end of the file, but we don’t want to keep empty lines in our code base for this reason.
System info:
Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
SonarScanner for MSBuild 5.7.1
INFO: SonarScanner 4.7.0.2747
INFO: Java 11.0.1 Oracle Corporation (64-bit)
INFO: Windows Server 2016 10.0 amd64
Sonar server: Developer Edition Version 8.9.9 (build 56886)
Error:
java.lang.IllegalStateException: Line 87 is out of range in the file REDACTED (lines: 85)
@pregress As recommended to @yd.endress – a wider range of logs (not just the single line) would help in understanding when/where during analysis the issue occurs.
Confirm, I had the same issue. I used older coverage.xml report (to save time during sonarqube setup) and there was difference between rapport and current code base, thanks for your answers
I have the same issue in Jenkins, there is no pre-existed coverage.xml to be deleted as I build fresh inside the docker container, if I add an extra line to the file it will be fixed but I don’t like the solution.
I also created a new project in SonarQube but it didn’t help
I am using latest sonarscanner 6.x.x.x
SonarQube version is Developer Edition Version 10.3 (build 82913)
what else you need me to provide you for debugging?