title: SonarQube C# Analysis Fails to 'Not a Valid Line Offset for Pointer'
body: <p>I have projects that I've been analysing with SonarQube succesfully for a while, but now I'm having some errors. The exact error is:</p>
  
  <pre><code>12:26:01.413 ERROR: Error during SonarQube Scanner execution
  java.lang.IllegalArgumentException: 74 is not a valid line offset for pointer. File [blaablaablaa...] has 70 character(s) at line 118
      at org.sonar.api.internal.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
      at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid(DefaultInputFile.java:252)
      at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:186)
      at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange(DefaultInputFile.java:202)
      at org.sonarsource.dotnet.shared.plugins.AbstractSensor$SarifParserCallbackImplementation.onIssue(AbstractSensor.java:160)
      at org.sonarsource.dotnet.shared.sarif.SarifParser10.handleResultFileElement(SarifParser10.java:130)
      at org.sonarsource.dotnet.shared.sarif.SarifParser10.handleLocationsElement(SarifParser10.java:102)
      at org.sonarsource.dotnet.shared.sarif.SarifParser10.handleIssue(SarifParser10.java:73)
      at org.sonarsource.dotnet.shared.sarif.SarifParser10.handleIssues(SarifParser10.java:62)
      at org.sonarsource.dotnet.shared.sarif.SarifParser10.accept(SarifParser10.java:54)
      at org.sonarsource.dotnet.shared.sarif.SarifParser10.accept(SarifParser10.java:37)
      at org.sonar.plugins.csharp.CSharpSensor.importRoslynReport(CSharpSensor.java:188)
      at org.sonar.plugins.csharp.CSharpSensor.executeInternal(CSharpSensor.java:123)
      at org.sonar.plugins.csharp.CSharpSensor.execute(CSharpSensor.java:79)
      at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
      at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:57)
      at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:49)
      at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:78)
      at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:175)
      at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
      at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
      at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:262)
      at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:257)
      at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:255)
      at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:247)
      at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
      at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
      at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
      at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
      at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
      at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
      at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:118)
      at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:117)
      at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
  12:26:01.419 DEBUG: Execution getVersion
  12:26:01.420 DEBUG: Execution stop
      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)
  </code></pre>
  
  <p>I have updated the C# analyzer to the latest (<strong>5.10.1 (build 1411) installed</strong>). At least the update center doesn't provide a newer?</p>
  
  <p>I also updated the scanner to <strong>sonar-scanner-msbuild-2.3.2.573</strong></p>
  
  <p>I'm using <strong>SQ 6.3.1.21392</strong></p>
  
  <p>There are quite a few similar posts here in SO, but all of them are pretty old and they suggest that it's either a known bug in the analyzer or an encoding issue. I've tried to change the problem file encoding to plain UTF-8, but that doesn't resolve the issue. Notepad++ shows the encoding is UTF-8-BOM. I've also used the bomremover, but that doesn't change the error at all. </p>
  
  <p>Any suggestions what to try except to exclude all the problem files from the analyse?</p>
  
  <p><strong>EDIT</strong><br>
  The encoding of the file is UTF-8-BOM, but it makes no difference to convert it to plain UTF-8.  </p>
  
  <p><a href="https://i.stack.imgur.com/vzqDR.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/vzqDR.jpg" alt="File encoding of the problem file"></a></p>
  
  <p>I used Notepad++ convert to UTF-8 and re-run the analysis. Same error as a result and here's a screenshot of the new encoding:  </p>
  
  <p><a href="https://i.stack.imgur.com/YQBi3.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/YQBi3.jpg" alt="converted file encoding"></a></p>