我已经使用SonarQube成功分析了一段时间,但是现在出现了一些错误。确切的错误是:
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)
我已经将C#分析器更新到最新版本(已安装5.10.1(内部版本1411))。至少更新中心没有提供更新?
我还将扫描仪更新为sonar-scanner-msbuild-2.3.2.573
我正在使用SQ 6.3.1.21392
SO中有很多类似的帖子,但是它们都相当古老,它们表明这要么是分析器中的已知错误,要么是编码问题。我试图将问题文件编码更改为普通UTF-8,但这不能解决问题。 Notepad ++显示编码为UTF-8-BOM。我也使用过bomremover,但这根本不会改变错误。
除了从分析中排除所有问题文件外,还有什么建议可以尝试?
编辑
该文件的编码为UTF-8-BOM,但将其转换为普通UTF-8没什么区别。
我使用Notepad ++转换为UTF-8,然后重新运行分析。结果是相同的错误,这是新编码的屏幕截图:
最佳答案
通过重新克隆存储库并再次运行分析解决了该问题。问题的根本原因仍然未知。
如果您遇到相同的问题,请尝试通过将存储库克隆到其他位置或通过将文件内容复制粘贴到新创建的文件中来再次重新创建文件。
关于c# - SonarQube C#分析失败为“指针的行偏移量无效”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43997878/