title: ERROR: Error during SonarScanner execution java.lang.IllegalArgumentException: Line xx is out of range for file IService.cs. File has xx lines
body: <p>I am trying to use <a href="https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-msbuild/" rel="nofollow noreferrer">SonarScanner</a> to scan and analysis my project C# source code. I can build all my projects without error. I have run all these commands successfully.</p>
  <blockquote>
  <p>dotnet tool install --global dotnet-sonarscanner</p>
  <p>dotnet sonarscanner begin /k:&quot;test&quot;
  /d:sonar.host.url=&quot;http://localhost:9000&quot;  /d:sonar.login=&quot;token&quot;</p>
  <p>dotnet build</p>
  </blockquote>
  <p>But when I run the last command below, it got an error</p>
  <blockquote>
  <p>dotnet sonarscanner end /d:sonar.login=&quot;51bae4230d438e567f84b8310f129938c73dd3f2&quot;</p>
  </blockquote>
  <p>This is the error message:</p>
  <blockquote>
  <p>ERROR: Error during SonarScanner execution INFO:
  ------------------------------------------------------------------------ java.lang.IllegalArgumentException: Line 15 is out of range for file
  xx/IService.cs. File has 14 lines.
  at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
  at org.sonar.scanner.DefaultFileLinesContext.checkLineRange(DefaultFileLinesContext.java:63)
  at org.sonar.scanner.DefaultFileLinesContext.setIntValue(DefaultFileLinesContext.java:56)
  at org.sonarsource.dotnet.shared.plugins.protobuf.MetricsImporter.consumeFor(MetricsImporter.java:66)
  at org.sonarsource.dotnet.shared.plugins.protobuf.MetricsImporter.consumeFor(MetricsImporter.java:38)
  at org.sonarsource.dotnet.shared.plugins.protobuf.ProtobufImporter.consume(ProtobufImporter.java:73)
  at org.sonarsource.dotnet.shared.plugins.protobuf.RawProtobufImporter.accept(RawProtobufImporter.java:49)
  at org.sonarsource.dotnet.shared.plugins.ProtobufDataImporter.parseProtobuf(ProtobufDataImporter.java:97)
  at org.sonarsource.dotnet.shared.plugins.ProtobufDataImporter.importResults(ProtobufDataImporter.java:72)
  at org.sonarsource.dotnet.shared.plugins.DotNetSensor.importResults(DotNetSensor.java:101)
  at org.sonarsource.dotnet.shared.plugins.DotNetSensor.execute(DotNetSensor.java:81)
  at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
  at org.sonar.scanner.sensor.ProjectSensorsExecutor.execute(ProjectSensorsExecutor.java:49)
  at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:360)
  at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
  at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
  at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:150)
  at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
  at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
  at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
  at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
  at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
  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:498)
  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:189)
  at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
  at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
  at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
  at org.sonarsource.scanner.cli.Main.main(Main.java:61) ERROR: The SonarScanner did not complete successfully 14:43:25.558
  Post-processing failed. Exit code: 1</p>
  </blockquote>
  <p>I went to check IService.cs, it is 14 lines and see no issue there. In fact, as mentioned, I can build all my projects without error.</p>