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.



Thank you for your tips.
I got newest Releases · SonarSource/sonar-scanner-msbuild · GitHub, did not help


I will try to run it on another computer.



I will add that I have a second project based on the .netcore environment. Works flawlessly.

This is even more puzzling :slight_smile:

OK, so let me try to summarize, and correct me if I am wrong:

  • you are trying to analyze a dotnet framework project, running the SonarScanner for .NET (6.2.0-net-framework bundle) from your development machine
  • the analysis fails in the end step, with NullPointerException: source at org.sonarsource.scanner.cli.ScannerVersion.<init>(
  • doing exactly the same on a dotnet core project (so using the 6.2.0-net bundle) on the same machine works fine

If the previous statements are correct, I don’t really understand the source of the problem. The only guess would be that some anti-malware program (like Windows Defender) would be interfering, and that its behavior would be different if the entry point is dotnet framework or dotnet core, but this would be the first time I see this case. If you have permission on your machine, can you temporarily put the scanner installation folder in the whitelist of your anti-malware, and see if that fixes the issue?


These are two completely different projects. One based on .net and the other on .netcore.

I will try to “disable” Defender/ESET and repeat the tests. I’ll write what happened

Best regards.