gpt4 book ai didi

c# - SonarQube C#分析失败 'Not a Valid Line Offset for Pointer'

转载 作者:行者123 更新时间:2023-11-30 12:56:01 25 4
gpt4 key购买 nike

我有一段时间以来一直使用 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 (build 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 没有任何区别。

File encoding of the problem file

我使用 Notepad++ 转换为 UTF-8 并重新运行分析。与结果相同的错误,这是新编码的屏幕截图:

converted file encoding

最佳答案

问题已通过重新克隆存储库并再次运行分析得到解决。问题的根本原因仍然未知。

如果您遇到同样的问题,请尝试通过将存储库克隆到不同位置或将文件内容复制粘贴到新创建的文件中来重新创建文件。

关于c# - SonarQube C#分析失败 'Not a Valid Line Offset for Pointer',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43997878/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com