Null error when branch name has -improve- within it


When we have the branch name with the -improve- within its name we get the following error from the command “SonarScanner.MSBuild.exe end /d:sonar.login={TOKEN HERE}”


INFO: Load project pull requests (done) | time=83ms
INFO: Load branch configuration
INFO: ------------------------------------------------------------------------
INFO: ------------------------------------------------------------------------
INFO: Total time: 14.015s
INFO: Final Memory: 19M/74M
INFO: ------------------------------------------------------------------------
powershell.exe : ERROR: Error during SonarScanner execution
At D:\jenkins1\workspace\3217-improve-load-for-edit-event@tmp\durable-c594c053\powershellWrapper.ps1:3 char:1

  • & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm …
  •   + CategoryInfo          : NotSpecified: (ERROR: Error du...anner execution:String) [], RemoteException
      + FullyQualifiedErrorId : NativeCommandError

ERROR: For input string: “null”
The SonarScanner did not complete successfully

The branch name works with dotnet-sonarscanner, its a bug when using SonarScanner.MSBuild.exe

1 Like

@Garry welcome to the community.

I can’t repro this locally - running the following commands from the command line works correctly for me:

SonarScanner.MSBuild.exe begin -d:sonar.login=redacted -d:sonar.password=redacted -k:junk
msbuild /t:rebuild
SonarScanner.MSBuild.exe end -d:sonar.login=redacted -d:sonar.password=redacted

The version of the Scanner for .NET you are using must be quite old if it is using SonarScanner v4.4.0.2170 internally. Try updating to the latest version of the Scanner for .NET. I wouldn’t expect it to make a difference, but it might.

Can you successfully uses dashes in the branch name if you call the SonarScanner.MSBuild.exe from the command line? If so, it suggests there is a problem with the way the arguments are being escaped in your PowerShell script.

Ok thanks for looking, we have now moved over to dotnet-sonarscanner & that’s working fine.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.