ERROR: Error during SonarQube Scanner execution
java.lang.IllegalArgumentException: 102 is not a valid line offset for pointer. File SettingsManager/StringCipher.cs has 94 character(s) at line 19
at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid(DefaultInputFile.java:339)
at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:272)
at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange(DefaultInputFile.java:288)
at org.sonarsource.dotnet.shared.plugins.SensorContextUtils.toTextRange(SensorContextUtils.java:43)
at org.sonarsource.dotnet.shared.plugins.protobuf.CPDTokensImporter.consumeFor(CPDTokensImporter.java:48)
at org.sonarsource.dotnet.shared.plugins.protobuf.CPDTokensImporter.consumeFor(CPDTokensImporter.java:34)
at org.sonarsource.dotnet.shared.plugins.protobuf.ProtobufImporter.consume(ProtobufImporter.java:74)
at org.sonarsource.dotnet.shared.plugins.protobuf.RawProtobufImporter.accept(RawProtobufImporter.java:49)
at org.sonarsource.dotnet.shared.plugins.ProtobufDataImporter.parseProtobuf(ProtobufDataImporter.java:104)
at org.sonarsource.dotnet.shared.plugins.ProtobufDataImporter.importResults(ProtobufDataImporter.java:75)
at org.sonarsource.dotnet.shared.plugins.DotNetSensor.executeInternal(DotNetSensor.java:95)
at org.sonarsource.dotnet.shared.plugins.DotNetSensor.execute(DotNetSensor.java:73)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:62)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:386)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:382)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:351)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
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(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:185)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137)
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 SonarQube Scanner did not complete successfully
08:38:31.356 Post-processing failed. Exit code: 1
Thank you for sharing pb files. It looks that there’s one line shift in the line offset. Can you please ZIP and share \Source\SettingsManager\StringCipher.cs file of your project with us privately?
Try to replace paths in this snippet and run it. It should produce output file with empty lines and special characters. Verify that the new file does not reveal any secret, ZIP it and share it privately please.
using System.Collections.Generic;
using System.IO;
static class InvalidOffsetPointer
{
static void ExtractBytes()
{
var srcFile = @"PATH TO YOUR\StringCipher.cs";
var dstFile = @"PATH ANYWHERE\StringCipher-Output.cs";
var lst = new List<byte>();
byte prev = 0;
foreach(var cur in File.ReadAllBytes(srcFile))
{
if (prev >= 128 || cur < 32 || cur >= 128)
{
lst.Add(cur);
}
prev = cur;
}
File.WriteAllBytes(dstFile, lst.ToArray());
}
}
How long is the line 18?
I expect 94 characters long comment line, based on the error message.
If not, is there any other line that is 94 characters long?
Line 19 should contain three concatenated string literals as value.
Is the line 116 characters long?
Are the literals all in a single line?
Can you try to narrow the cause like this?
change them to literals like “aaaaaaa” with the same length and re-run the analysis. Does the problem persists? If yes, sharing this line of this modified code would be enough.
change them to single literal “aaa”; and re-run the analysis. Does the problem persists?
Edit: changed “sharing first 20 lines” to “sharing this line”
Ok, that looks like the cause. You’re probably setting string of different length there. Change your in-code value to the string of the same length as your real-build value and that will solve your problem.