0
votes

I installed SonarQube 6.1 with MSBuild.SonarQube.Runner-2.2.0.24 to analyse a C# solution. When I run an analysis, I get the following error:

WARN: SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to define SCM of your project. ERROR: Error during SonarQube Scanner execution java.lang.IllegalArgumentException: Start pointer [line=90, lineOffset=89] should be before end pointer [line=90, lineOffset=89] at org.sonar.api.internal.google.common.base.Preconditions.checkArgument(Preconditions.java:145) at org.sonar.api.batch.fs.internal.DefaultInputFile.newRangeValidPointers(DefaultInputFile.java:254) at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange(DefaultInputFile.java:238) at org.sonarsource.dotnet.shared.plugins.AbstractSensor$SarifParserCallbackImplementation.onIssue(AbstractSensor.java:144) at org.sonarsource.dotnet.shared.sarif.SarifParser01And04.handleAnalysisTargetElement(SarifParser01And04.java:109) at org.sonarsource.dotnet.shared.sarif.SarifParser01And04.handleIssue(SarifParser01And04.java:73) at org.sonarsource.dotnet.shared.sarif.SarifParser01And04.handleIssues(SarifParser01And04.java:55) at org.sonarsource.dotnet.shared.sarif.SarifParser01And04.parse(SarifParser01And04.java:43) at org.sonar.plugins.csharp.CSharpSensor.importRoslynReport(CSharpSensor.java:183) at org.sonar.plugins.csharp.CSharpSensor.executeInternal(CSharpSensor.java:118) at org.sonar.plugins.csharp.CSharpSensor.execute(CSharpSensor.java:85) 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:182) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:247) at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:242) at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:240) at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:232) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) 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:142) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:115) at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:118) 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. The SonarQube Scanner did not complete successfully 08:42:09.074 Post-processing failed. Exit code: 1

When I start the SonarQube Scanner with the -X like it was recommended in the error message, I get this:

2016-11-14T14:33:27.2720044Z ##[error]15:33:27.238  Unrecognized command line argument: -X
2016-11-14T14:33:27.2720044Z ##[error]15:33:27.261  Expecting at least the following command line argument:
2016-11-14T14:33:27.2730045Z ##[error]- SonarQube project key
2016-11-14T14:33:27.2730045Z ##[error]When connecting to a SonarQube server earlier than version 6.1, the following command line arguments are also required:
2016-11-14T14:33:27.2740046Z ##[error]- SonarQube project name
2016-11-14T14:33:27.2740046Z ##[error]- SonarQube project version
2016-11-14T14:33:27.2750047Z ##[error]The full path to a settings file can also be supplied. If it is not supplied, the exe will attempt to locate a default settings file in the same directory as the SonarQube Scanner for MSBuild.
2016-11-14T14:33:27.2750047Z ##[error]15:33:27.261  Pre-processing failed. Exit code: 1

I start the scanner with:

SonarQube.Scanner.MSBuild.exe begin /k:ProjectKey /n:ProjectName /v:4.0.70 

The end command is

SonarQube.Scanner.MSBuild.exe end

Start is definively called before end. What could be wrong?

2
I reverted my SonarQube installation to version 5.6. I prefer to wait until the bugs are fixed.tobre
as said in stackoverflow.com/a/40382162/244993 - this is about C# Plugin, not about SonarQube, and mentioned bug is already fixed in C# Plugin version 5.5.Godin
I updated again to 6.1 of SonarQube with C# Plugin version 5.5.0.479. Unfortunately, I get the same error: ERROR: Error during SonarQube Scanner execution java.lang.IllegalArgumentException: Start pointer [line=90, lineOffset=89] should be before end pointer [line=90, lineOffset=89]tobre
why not commenting on answer stackoverflow.com/a/40382162/244993 ? the author of the answer is an author of fix and definitely knows more than me about this storyGodin

2 Answers

1
votes

I've stumbled in the same trouble and it could be caused by a not UTF-8 or a BOM enabled UTF-8 encoding, see here for reference:

Analysis of Visual Studio Solutions containing some C# source files using a non UTF-8 encoding fails

As a possible WA waiting for a fix, try to force source encoding to UTF-8 and, if not enough, to explicitly convert your sources to BOM-less UTF-8 encoding.

0
votes

I have same problem and I found some issue in the code source.

    public class Myclass : BaseClass
    {
        public Myclass(OtherClass inputs) : base() => Initialize(); //OK 

        public Myclass(OtherClass inputs) : base() => Initialize(inputs); //NOK
        //Sonar cannot analyze this method because of arguments insides Initiliaze  //method with inline method only when I use : base(...) => Func(With Arguments);
         //Solution is

        public Myclass(OtherClass inputs) : base() 
        {
           Initialize(inputs);} 
        }
    }