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.