ArgumentNullException in SonarQube Scanner for MSBuild 3.0.2

261 views
Skip to first unread message

m...@soloplan.de

unread,
Sep 5, 2017, 8:30:23 AM9/5/17
to SonarQube
Hello,

I'm trying to setup a new SonarQube project and connect it to a new Jenkins nightly build. Sadly, I'm getting an ArgumentNullException with not much information to go on. Whatever happens, in my opinion an ArgumentNullException should not surface. It should be handled inside and instead a useful error message should be written to the log.

11:33:24 Unpacking https://github.com/SonarSource/sonar-scanner-msbuild/releases/download/3.0.2.656/sonar-scanner-msbuild-3.0.2.656.zip [^] to C:\Jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\sonarqube.server.de on Jenkins
11:33:26 [workspace] $ C:\Jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\sonarqube.server.de\MSBuild.SonarQube.Runner.exe begin /k:secretprojectkey "/n:MyProject" /v:trunk /d:sonar.host.url=http://sonarqube.server.de:9001 [^] /d:sonar.login=build ******** /d:sonar.resharper.cs.reportPath=resharper-results.xml /d:sonar.resharper.solutionFile=MyCompany\MyProject\MyCompany.MyProject.sln /d:sonar.cs.nunit.reportsPaths=NUnit-results.xml
11:33:27 SonarQube Scanner for MSBuild 3.0.2
11:33:27 Default properties file was found at C:\Jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\sonarqube.server.de\SonarQube.Analysis.xml
11:33:27 Loading analysis properties from C:\Jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\sonarqube.server.de\SonarQube.Analysis.xml
11:33:27 Pre-processing started.
11:33:27 Preparing working directories...
11:33:27 11:33:27.198  Updating build integration targets...
11:33:27 11:33:27.276  Fetching analysis configuration settings...
11:33:28 
11:33:28 Unhandled Exception: System.ArgumentNullException: Value cannot be null.
11:33:28 Parameter name: source
11:33:28    at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
11:33:28    at SonarQube.TeamBuild.PreProcessor.SonarWebService.<>c__DisplayClass8_2.<GetActiveRules>b__1(JObject r)
11:33:28    at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
11:33:28    at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
11:33:28    at SonarQube.TeamBuild.PreProcessor.SonarWebService.GetActiveRules(String qprofile)
11:33:28    at SonarQube.TeamBuild.PreProcessor.TeamBuildPreProcessor.FetchArgumentsAndRulesets(ISonarQubeServer server, ProcessedArgs args, TeamBuildSettings settings, IDictionary`2& serverSettings, List`1& analyzersSettings)
11:33:28    at SonarQube.TeamBuild.PreProcessor.TeamBuildPreProcessor.DoExecute(ProcessedArgs localSettings)
11:33:28    at SonarQube.TeamBuild.PreProcessor.TeamBuildPreProcessor.Execute(String[] args)
11:33:28    at SonarQube.Bootstrapper.BootstrapperClass.PreProcess()
11:33:28    at SonarQube.Bootstrapper.BootstrapperClass.Execute()
11:33:28    at SonarQube.Bootstrapper.Program.Execute(String[] args, ILogger logger)
11:33:28    at SonarQube.Bootstrapper.Program.Main(String[] args)
11:33:28    at SonarQube.Old.Bootstrapper.Program.Main(String[] args)
11:33:29 ERROR: Execution of SonarQube Scanner for MSBuild failed (exit code -532.462.766)

I get the same exception when I execute this command line locally. We have two SonarQube instances, one "production" instance and one "playground" instance to test updates and new configurations. At the moment, they are identical (I've imported the database from production into the playground instance).
Interestingly, when I switch to the production instance, no exception.

It get this exception for any project right now. When running in "verbose" mode the exception seems to happen after downloading the quality profiles from the SonarQube instance (SonarQube is version 6.5 with C# plugin 6.3):
Fetching analysis configuration settings...
Downloading from http://sonarqube.server.de:9001/api/server/version...
Fetching properties for project 'myproject:core' from http://sonarqube.server.de:9001/api/settings/values?component=myproject%3Acore...
Downloading from http://sonarqube.server.de:9001/api/settings/values?component=myproject%3Acore...
Downloading from http://sonarqube.server.de:9001/api/languages/list...
Fetching quality profile for project 'myproject:core' from http://sonarqube.server.de:9001/api/qualityprofiles/search?projectKey=myproject%3Acore...
Downloading from http://sonarqube.server.de:9001/api/qualityprofiles/search?projectKey=myproject%3Acore...
Fetching active rules for quality profile 'cs-myproject-core-17443' from http://sonarqube.server.de:9001/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&activation=true&qprofile=cs-myproject-core-17443&p=1...
Downloading from http://sonarqube.server.de:9001/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&activation=true&qprofile=cs-myproject-core-17443&p=1...
-> callstack as shown above

Has anyone an idea what might be the problem? I'm at a loss right now.

Thanks,
Markus

G. Ann Campbell

unread,
Sep 5, 2017, 11:56:08 AM9/5/17
to SonarQube, m...@soloplan.de
Hi Markus,

In that stacktrace is there a "caused by" line in verbose mode?


Ann

m...@soloplan.de

unread,
Sep 6, 2017, 2:03:24 AM9/6/17
to SonarQube, m...@soloplan.de
Hi Ann,

thanks for your feedback. Sadly, no there is no "caused by" line. I just tried it again. When executing the command line in verbose mode the last line states that it is downloading the active rules from the SonarQube instance, next comes the callstack (and a Windows message box that "SonarQube.Old.Bootstrapper has stopped working"):

07:57:51.467  Fetching active rules for quality profile 'cs-myproject-core-17443' from http://sonarqube.server.de:9001/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&activation=true&qprofile=cs-myproject-core-17443&p=1...
07:57:51.468  Downloading from http://sonarqube.server.de:9001/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&activation=true&qprofile=cs-myproject-core-17443&p=1...


Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: source

   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
   at SonarQube.TeamBuild.PreProcessor.SonarWebService.<>c__DisplayClass8_2.<GetActiveRules>b__1(JObject r)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()

   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
   at SonarQube.TeamBuild.PreProcessor.SonarWebService.GetActiveRules(String qprofile)

   at SonarQube.TeamBuild.PreProcessor.TeamBuildPreProcessor.FetchArgumentsAndRulesets(ISonarQubeServer server, ProcessedArgs args, TeamBuildSettings settings, IDictionary`2& serverSettings, List`1& analyzersSettings)
   at SonarQube.TeamBuild.PreProcessor.TeamBuildPreProcessor.DoExecute(ProcessedArgs localSettings)
   at SonarQube.TeamBuild.PreProcessor.TeamBuildPreProcessor.Execute(String[] args)
   at SonarQube.Bootstrapper.BootstrapperClass.PreProcess()
   at SonarQube.Bootstrapper.BootstrapperClass.Execute()

   at SonarQube.Bootstrapper.Program.Execute(String[] args, ILogger logger)
   at SonarQube.Bootstrapper.Program.Main(String[] args)
   at SonarQube.Old.Bootstrapper.Program.Main(String[] args)

Bye,
Markus
Reply all
Reply to author
Forward
0 new messages