Sonarqube TFS Extension Failing on Run Code Analysis with System.Runtime.InteropServices.COMException: Element not found

tfs
sonarqube

(Bong Angeles) #1

Running the following task in TFS 2018:
2018-08-01T15:59:55.9473704Z ##[section]Starting: Run Code Analysis
2018-08-01T15:59:55.9473704Z ==============================================================================
2018-08-01T15:59:55.9473704Z Task : Run Code Analysis
2018-08-01T15:59:55.9473704Z Description : Run scanner and upload the results to the SonarQube server.
2018-08-01T15:59:55.9484185Z Version : 4.3.0
2018-08-01T15:59:55.9484185Z Author : sonarsource

But getting below error in the Code Analysis task:

2018-08-01T15:59:56.6023579Z 15:59:56.601 Attempting to locate the CodeCoverage.exe tool…
2018-08-01T15:59:56.6063574Z 15:59:56.606 Attempting to locate the CodeCoverage.exe tool using setup configuration…
2018-08-01T15:59:56.6173812Z ##[error]Unhandled Exception:
2018-08-01T15:59:56.6173812Z
2018-08-01T15:59:56.6223290Z ##[error]System.Runtime.InteropServices.COMException: Element not found. (Exception from HRESULT: 0x80070490)

Detailed error message:

2018-08-01T15:59:55.9484185Z ==============================================================================
2018-08-01T15:59:56.3293670Z [command]F:\NewAgent1\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.3.2\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe end
2018-08-01T15:59:56.4103639Z SonarScanner for MSBuild 4.3.1
2018-08-01T15:59:56.4113620Z Using the .NET Framework version of the Scanner for MSBuild
2018-08-01T15:59:56.4683743Z Default properties file was found at F:\NewAgent1\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.3.2\classic-sonar-scanner-msbuild\SonarQube.Analysis.xml
2018-08-01T15:59:56.4683743Z Loading analysis properties from F:\NewAgent1\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.3.2\classic-sonar-scanner-msbuild\SonarQube.Analysis.xml
2018-08-01T15:59:56.4683743Z Post-processing started.
2018-08-01T15:59:56.5953790Z 15:59:56.594  Loading the SonarQube analysis config from F:\NewAgent1\_work\8\.sonarqube\conf\SonarQubeAnalysisConfig.xml
2018-08-01T15:59:56.5963383Z 15:59:56.595  TeamBuild environment detected
2018-08-01T15:59:56.5973660Z 15:59:56.596  Analysis base directory: F:\NewAgent1\_work\8\.sonarqube
2018-08-01T15:59:56.5973660Z Build directory: F:\NewAgent1\_work\8
2018-08-01T15:59:56.5973660Z Bin directory: F:\NewAgent1\_work\8\.sonarqube\bin
2018-08-01T15:59:56.5973660Z Config directory: F:\NewAgent1\_work\8\.sonarqube\conf
2018-08-01T15:59:56.5973660Z Output directory: F:\NewAgent1\_work\8\.sonarqube\out
2018-08-01T15:59:56.5973660Z Config file: F:\NewAgent1\_work\8\.sonarqube\conf\SonarQubeAnalysisConfig.xml
2018-08-01T15:59:56.6023579Z 15:59:56.601  Attempting to locate the CodeCoverage.exe tool...
2018-08-01T15:59:56.6063574Z 15:59:56.606  Attempting to locate the CodeCoverage.exe tool using setup configuration...
2018-08-01T15:59:56.6173812Z ##[error]Unhandled Exception:
2018-08-01T15:59:56.6173812Z 
2018-08-01T15:59:56.6223290Z ##[error]System.Runtime.InteropServices.COMException: Element not found. (Exception from HRESULT: 0x80070490)
   at Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.GetPackages()
   at SonarScanner.MSBuild.TFS.Classic.BinaryToXmlCoverageReportConverter.GetExeToolPathFromSetupConfiguration()
   at SonarScanner.MSBuild.TFS.Classic.BinaryToXmlCoverageReportConverter.GetExeToolPath()
   at SonarScanner.MSBuild.TFS.Classic.BinaryToXmlCoverageReportConverter.Initialize()
   at SonarScanner.MSBuild.TFS.CoverageReportProcessorBase.Initialise(AnalysisConfig config, ITeamBuildSettings settings)
   at SonarScanner.MSBuild.PostProcessor.CoverageReportProcessor.Initialise(AnalysisConfig config, ITeamBuildSettings settings)
   at SonarScanner.MSBuild.PostProcessor.MSBuildPostProcessor.Execute(String[] args, AnalysisConfig config, ITeamBuildSettings settings)
   at SonarScanner.MSBuild.BootstrapperClass.PostProcess()
   at SonarScanner.MSBuild.BootstrapperClass.Execute()
   at SonarScanner.MSBuild.Program.Execute(String[] args, ILogger logger)
   at SonarScanner.MSBuild.Program.Main(String[] args)
2018-08-01T15:59:56.6223290Z System.Runtime.InteropServices.COMException: Element not found. (Exception from HRESULT: 0x80070490)
2018-08-01T15:59:56.6223290Z    at Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.GetPackages()
2018-08-01T15:59:56.6223290Z    at SonarScanner.MSBuild.TFS.Classic.BinaryToXmlCoverageReportConverter.GetExeToolPathFromSetupConfiguration()
2018-08-01T15:59:56.6223290Z    at SonarScanner.MSBuild.TFS.Classic.BinaryToXmlCoverageReportConverter.GetExeToolPath()
2018-08-01T15:59:56.6223290Z    at SonarScanner.MSBuild.TFS.Classic.BinaryToXmlCoverageReportConverter.Initialize()
2018-08-01T15:59:56.6223290Z    at SonarScanner.MSBuild.TFS.CoverageReportProcessorBase.Initialise(AnalysisConfig config, ITeamBuildSettings settings)
2018-08-01T15:59:56.6223290Z    at SonarScanner.MSBuild.PostProcessor.CoverageReportProcessor.Initialise(AnalysisConfig config, ITeamBuildSettings settings)
2018-08-01T15:59:56.6223290Z    at SonarScanner.MSBuild.PostProcessor.MSBuildPostProcessor.Execute(String[] args, AnalysisConfig config, ITeamBuildSettings settings)
2018-08-01T15:59:56.6223290Z    at SonarScanner.MSBuild.BootstrapperClass.PostProcess()
2018-08-01T15:59:56.6223290Z    at SonarScanner.MSBuild.BootstrapperClass.Execute()
2018-08-01T15:59:56.6223290Z    at SonarScanner.MSBuild.Program.Execute(String[] args, ILogger logger)
2018-08-01T15:59:56.6223290Z    at SonarScanner.MSBuild.Program.Main(String[] args)
2018-08-01T15:59:56.6313682Z ##[error]F:\NewAgent1\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.3.2\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe failed with return code: 3762504530

Suggestions on fixes will be appreciated. Thanks