Latest SonarScanner failed on .net 4.8 project


SonarQube on docker.

  • Community Edition
  • Version 10.3 (build 82913)
  • Sonar-scanner-
  • openjdk version “17.0.9” 2023-10-17 LTS

I try to run locally SonarScanner on c# project, Visual Studio 2022, .net 4.8. On ending command SonarScanner.MSBuild.exe end…

i got exception:

INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
        at org.sonarsource.scanner.cli.SystemInfo.print(
        at org.sonarsource.scanner.cli.Main.init(
        at org.sonarsource.scanner.cli.Main.execute(
        at org.sonarsource.scanner.cli.Main.main(
Caused by: java.lang.NullPointerException: source
        at java.base/java.util.Objects.requireNonNull(
        at java.base/java.util.Scanner.<init>(
        at java.base/java.util.Scanner.<init>(
        at org.sonarsource.scanner.cli.ScannerVersion.<init>(
        at org.sonarsource.scanner.cli.ScannerVersion.<clinit>(
        ... 4 more
The SonarScanner did not complete successfully
18:15:00.706  Post-processing failed. Exit code: 1

Any idea how to resolve this issue?

Hey there.

Just to be quite sure (since you mention v5.0.1 when filling out the template), are you using the latest version of the Scanner for .NET, which is v6.0?


Im using:

SonarScanner for MSBuild 6.0
Using the .NET Framework version of the Scanner for MSBuild

That is:

I mistakenly entered the name of a subdirectory from this archive: sonar-scanner-

Hi @Tejot

We’ll need the logs:

  • please give us the verbose output of the scanner commands (please run SonarScanner.MSBuild.exe begin /k:“MyProject” /d:sonar.verbose=true as the begin step, and please attach the output of the BEGIN and END steps)
  • please give the output of running MSBuild in verbose mode (/v:d)

Also, please tell us:

  • what are the commands you are running to do the analysis?
  • are you running all commands from the same folder?

Share the Scanner for .NET verbose logs

  • Add /d:"sonar.verbose=true" to the…
    • SonarScanner.MSBuild.exe or dotnet sonarscanner begin command to get more detailed logs
      • For example: SonarScanner.MSBuild.exe begin /k:"MyProject" /d:"sonar.verbose=true"
  • The important logs are in the END step

Share the msbuild detailed logs

MsBuild.exe /t:Rebuild /v:d


dotnet build -v:d

Hi :slight_smile: .

Logs attached. Start, build and end. I send the content of build compressed.


SonarScanner.MSBuild.exe begin /k:"ZZZ-Analizy-Olap" /"https://xxx" /d:sonar.token="xxx" /d:"sonar.verbose=true"

"C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MsBuild.exe" /t:Rebuild /v:d

SonarScanner.MSBuild.exe end /d:sonar.token="xxx"

Running from the solution folder. (71.8 KB)
end.log (16.8 KB)
start.log (6.6 KB)

Hi @Tejot.

Sorry for the delayed response. We are still investigating this but have been unable to reproduce it.

Did you try to scan this project on another computer/setup?
Did you try to scan another project in the same setup?

Hi @Tejot

Sorry again for the long delay in the investigation.

The error seems to indicate that a file is missing in the scanner distribution. This is strange because the missing file should be included in one of the scanner libraries. Maybe the distribution got corrupted in your environment?
If you are still affected, may I ask you to check the content of the file C:\!\tools\sonar-scanner\sonar-scanner-\lib\sonar-scanner-cli- (you can open it as a ZIP archive). The file version.txt should be present at the root.

Then I would suggest getting a fresh installation of the SonarScanner for .NET and trying again.