Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
SonarScanner for MSBuild 4.8
Using the .NET Core version of the Scanner for MSBuild
Pre-processing started.
Preparing working directories...
15:21:50.317 Updating build integration targets...
15:21:50.34 Fetching analysis configuration settings...
15:21:50.35 Failed to request and parse 'sonarcloud.io/api/server/version': An exception occurred during a WebClient request.
Unhandled Exception: System.Net.WebException: An exception occurred during a WebClient request. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at SonarScanner.MSBuild.PreProcessor.WebClientDownloader.PersistentUserAgentWebClient.GetWebRequest(Uri address)
at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
--- End of inner exception stack trace ---
at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
at System.Net.WebClient.DownloadString(Uri address)
at SonarScanner.MSBuild.PreProcessor.SonarWebService.<>c__DisplayClass15_0.<DownloadServerVersion>b__0()
at SonarScanner.MSBuild.PreProcessor.SonarWebService.DoLogExceptions[T](Func`1 op, String url, Action`1 onError)
at SonarScanner.MSBuild.PreProcessor.SonarWebService.GetServerVersion()
at SonarScanner.MSBuild.PreProcessor.SonarWebService.GetProperties(String projectKey, String projectBranch)
at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.FetchArgumentsAndRulesets(ISonarQubeServer server, ProcessedArgs args, TeamBuildSettings settings, IDictionary`2& serverSettings, List`1& analyzersSettings)
at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.DoExecute(ProcessedArgs localSettings)
at SonarScanner.MSBuild.BootstrapperClass.PreProcess()
at SonarScanner.MSBuild.BootstrapperClass.Execute()
at SonarScanner.MSBuild.Program.Execute(String[] args, ILogger logger)
at SonarScanner.MSBuild.Program.Main(String[] args)
Steps to reproduce Install sonnarscanner in Vscode with dotnet tool install --global dotnet-sonarscanner
I am facing the same issue, when I am trying to analyse the dotnet project with MsBuild Plugin. I am doing this analysis via Jenkins, so I am using a token from admin user, technically has access to do everything in sonarqube.
However, I was able to do the analysis with sonarscanner CLI, but I am seeing issues only when I am trying this with Sonar Scanner MsBuild Plugin.
I also tried with d.sonar.host.url but the problem appears to remain the same. Can you please help.
we are using CE sonarqube version 8.3
Jenkins Pipeline log
dotnet sonarscanner begin /d:sonar.host.url=http://sqube.xyz.com /k:Sample-dotnet-MsBuild
SonarScanner for MSBuild 4.10
Using the .NET Core version of the Scanner for MSBuild
Pre-processing started.
Preparing working directories…
13:04:08.673 Updating build integration targets…
13:04:08.758 Fetching analysis configuration settings…
13:04:09.277 Failed to request and parse ‘http://sqube.xyz.com/api/server/version’: The remote server returned an error: (403) Forbidden.
Unhandled exception. System.Net.WebException: The remote server returned an error: (403) Forbidden.
at System.Net.HttpWebRequest.GetResponse() in //src/System.Net.Requests/src/System/Net/HttpWebRequest.cs:line 1004
at System.Net.WebClient.GetWebResponse(WebRequest request) in //src/System.Net.WebClient/src/System/Net/WebClient.cs:line 249
at System.Net.WebClient.DownloadBits(WebRequest request, Stream writeStream) in //src/System.Net.WebClient/src/System/Net/WebClient.cs:line 818
at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request) in //src/System.Net.WebClient/src/System/Net/WebClient.cs:line 297
at System.Net.WebClient.DownloadString(Uri address) in //src/System.Net.WebClient/src/System/Net/WebClient.cs:line 684
at System.Net.WebClient.DownloadString(String address) in //src/System.Net.WebClient/src/System/Net/WebClient.cs:line 674
at SonarScanner.MSBuild.PreProcessor.WebClientDownloader.Download(String url)
at SonarScanner.MSBuild.PreProcessor.SonarWebService.<>c__DisplayClass15_0.b__0()
at SonarScanner.MSBuild.PreProcessor.SonarWebService.DoLogExceptions[T](Func1 op, String url, Action1 onError)
at SonarScanner.MSBuild.PreProcessor.SonarWebService.DownloadServerVersion()
at SonarScanner.MSBuild.PreProcessor.SonarWebService.GetServerVersion()
at SonarScanner.MSBuild.PreProcessor.SonarWebService.GetProperties(String projectKey, String projectBranch)
at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.FetchArgumentsAndRulesets(ISonarQubeServer server, ProcessedArgs args, TeamBuildSettings settings, IDictionary2& serverSettings, List1& analyzersSettings)
at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.DoExecute(ProcessedArgs localSettings)
at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.Execute(String args)
at SonarScanner.MSBuild.BootstrapperClass.PreProcess()
at SonarScanner.MSBuild.BootstrapperClass.Execute()
at SonarScanner.MSBuild.Program.Execute(String args, ILogger logger)
at SonarScanner.MSBuild.Program.Execute(String args, Boolean showDeprecatedWarning)
at SonarScanner.MSBuild.Program.Main(String args)
[Pipeline] }
WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeeded?