6

We have a quite large code base, and one of the projects breaks the SonarQube analysis with the following error.

016-12-15T11:20:30.8989361Z ##[error]ERROR: Error during SonarQube Scanner execution 
2016-12-15T11:20:30.8999277Z ##[error]java.lang.IllegalStateException: Line 1203 is out of range in the file Converters/IMSServiceToESBConverter.cs (lines: 1202)

We are using SonarQube 6.1 and the latest C# plugin (5.5.1.522).

Disabling all rules in the C# profile still causes this problem.

G. Ann - SonarSource Team
  • 22,346
  • 4
  • 40
  • 76
  • Could you check the encoding of this file? We had issues lately with encoding, but those bugs were supposed to be fixed. Are there any special characters in the file? – Tamas Dec 15 '16 at 13:04
  • At the same time could you share information on your build environment? Are you using msbuild12 or msbuild14. Which version exactly? `msbuild /version` – Tamas Dec 15 '16 at 13:05
  • The file is encoded in UTF8 according to Notepad++ and I can't see any special characters. We upgraded from SonarQube and the C# plugin recently and there was no problem previously. Build environment: C:\Program Files (x86)\MSBuild\14.0\Bin>msbuild /version Microsoft (R) Build engine version 14.0.25420.1 Copyright (C) Microsoft Corporation. All rights reverved. 14.0.25420.1 I can provide the file in private if it can help you identify the issue. – Kristian Leonhard Dec 16 '16 at 20:21
  • For some reason we are now getting the same error in several other files. These are files that has not been changed at all for months, and where the SonarQube analysis has been fine. It seems to be very random. – Kristian Leonhard Dec 19 '16 at 09:02
  • 2
    Same problem here. Just updated SonarQube and C# plugin to 6.2/5.7, but no change. Using msbuild 14.0 – Chris Feb 20 '17 at 10:36
  • I've seen this error just now in one of our codebases. It started happening 2 days ago, previously worked. We're running SonarQube 5.6.6 LTS and C# plugin 5.8.0.660. I'm _not_ seeing this error in 2 other (different) code bases which also analyze C# code. The file in question hasn't changed in a year. Could this be related to [http://stackoverflow.com/q/39753072/129352](http://stackoverflow.com/q/39753072/129352) ? – llykke Mar 24 '17 at 11:22
  • I wiped everything including the datebase and reinstalled from scratch and the problem is gone. I have seen this several times. It appears out of the blue and I can't seem to find any other fix than to wipe and reinstall. – Kristian Leonhard Mar 25 '17 at 12:30
  • @KristianLeonhard Did you wipe the SonarQube installation or the build machine? I've seen [other post](http://stackoverflow.com/a/42405250/129352) that wiping and reinstalling Visual Studio Enterprise and Build Tools fixed the issue – llykke Apr 03 '17 at 21:09
  • I only wiped SonarQube installation and the database. I did not wipe VS or anything else. – Kristian Leonhard Apr 05 '17 at 05:47
  • I am also facing the same problem, i have checked the encoding of the file it is UTF-8.But it still fails with same error *java.lang.IllegalStateException: Line 133 is out of range in the file ''*. There are also other projects which are successfully analysed by sonar.Does anybody found the solution to this issue. – Sachin Gaikwad Jun 07 '17 at 05:41

1 Answers1

9

I also encountered the similar issue while running SonarQube with JaCoCo Code Coverage Reports for Java code:

ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Line [..] is out of range in the file [..]

The problem was due to the old code coverage report that was generated before updating the code. It was fixed after generating coverage reports again. So, please also make sure that the any coverage reports that are left behind from the previous run are cleared and new coverage reports are in place.

user1014639
  • 488
  • 4
  • 18