Null error when branch name has -improve- within it

sonar-scanner-4.4.0.2170

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}”

Error:

INFO: Load project pull requests (done) | time=83ms
INFO: Load branch configuration
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
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”
ERROR:
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.branch.name=xxx-improve-msbuild -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.