问题
This is related to Sonarqube C# scanner exception: "java.lang.IllegalArgumentException: is not a valid line offset for pointer"
Using Sonarqube v5.6.4 on a windows server, c# scanner v5.5.2.537.
MSBuild version is: Microsoft (R) Build Engine version 14.0.25420.1
I'm just using the non-service mode, StartSonar.bat
while trying to get it working on this codebase, if that makes any difference.
The GlobalSuppressions.cs
file in question is UTF-16. You can view it in an online hex editor.
INFO: Importing analysis results from X:\tfs\Sonar2016\.sonarqube\out\PROJECTNAME\output-cs
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 2:49.355s
INFO: Final Memory: 61M/2305M
ERROR: Error during SonarQube Scanner execution
INFO: ------------------------------------------------------------------------
java.lang.IllegalArgumentException: 47 is not a valid line offset for pointer. File [moduleKey=no_AfterCompile_NormalBuild:no_AfterCompile_NormalBuild:DB96E47F-8CF8-487B-A19C-69BE6EC13F0F, relative=GlobalSuppressions.cs, basedir=X:\tfs\Sonar2016\PROJECTLOCATION] has 1 character(s) at line 2
at org.sonar.api.internal.google.common.base.Preconditions.checkArgument(Preconditions.java:148)
at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid(DefaultInputFile.java:218)
at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:209)
at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange(DefaultInputFile.java:240)
at org.sonarsource.dotnet.shared.plugins.SensorContextUtils.toTextRange(SensorContextUtils.java:41)
at org.sonarsource.dotnet.shared.plugins.protobuf.HighlightImporter.consumeFor(HighlightImporter.java:51)
at org.sonarsource.dotnet.shared.plugins.protobuf.HighlightImporter.consumeFor(HighlightImporter.java:33)
at org.sonarsource.dotnet.shared.plugins.protobuf.ProtobufImporter.consume(ProtobufImporter.java:49)
at org.sonarsource.dotnet.shared.plugins.protobuf.RawProtobufImporter.accept(RawProtobufImporter.java:43)
at org.sonarsource.dotnet.shared.plugins.AbstractSensor.parseProtobuf(AbstractSensor.java:95)
at org.sonarsource.dotnet.shared.plugins.AbstractSensor.importResults(AbstractSensor.java:87)
at org.sonar.plugins.csharp.CSharpSensor.executeInternal(CSharpSensor.java:111)
at org.sonar.plugins.csharp.CSharpSensor.execute(CSharpSensor.java:82)
at org.sonar.batch.sensor.SensorWrapper.analyse(SensorWrapper.java:57)
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
at org.sonar.batch.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:83)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:234)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.batch.task.ScanTask.execute(ScanTask.java:47)
at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:106)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62)
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)
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:110)
at org.sonarsource.scanner.cli.Main.execute(Main.java:74)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
The SonarQube Scanner did not complete successfully
14:27:41.669 Creating a summary markdown file...
14:27:41.694 Post-processing failed. Exit code: 1
来源:https://stackoverflow.com/questions/41623172/sonarqube-c-sharp-v5-5-2-still-has-java-lang-illegalargumentexception-is-not-a