Sonarqube在.net core 2 app的覆盖范围内执行任务异常

时间:2017-10-02 13:55:33

标签: sonarqube azure-devops sonarqube-scan asp.net-core-2.0 .net-core-2.0

我认为这更像是一个错误报告,而不是支持问题,但可能我可以解决它。

我正在建设&测试.net core 2 app: image

vstest步骤配置如下: image

生成trx文件和二进制.coverage文件。

如果禁用Code coverage复选框,则构建有效。 如果在图片中启用,则会失败,并显示以下错误:

SonarQube Scanner for MSBuild 3.0.2
Default properties file was found at C:\agent\_work\_tasks\SonarQubeScannerMsBuildBegin_15b84ca1-b62f-4a2a-a403-89b77a063157\3.0.2\SonarQubeScannerMsBuild\SonarQube.Analysis.xml
Loading analysis properties from C:\agent\_work\_tasks\SonarQubeScannerMsBuildBegin_15b84ca1-b62f-4a2a-a403-89b77a063157\3.0.2\SonarQubeScannerMsBuild\SonarQube.Analysis.xml
Post-processing started.
13:15:00.927  Loading the SonarQube analysis config from C:\agent\_work\3\.sonarqube\conf\SonarQubeAnalysisConfig.xml
13:15:00.927  TeamBuild environment detected
13:15:00.927  Analysis base directory: C:\agent\_work\3\.sonarqube
Build directory: C:\agent\_work\3
Bin directory: C:\agent\_work\3\.sonarqube\bin
Config directory: C:\agent\_work\3\.sonarqube\conf
Output directory: C:\agent\_work\3\.sonarqube\out
Config file: C:\agent\_work\3\.sonarqube\conf\SonarQubeAnalysisConfig.xml
13:15:00.927  Attempting to locate the CodeCoverage.exe tool...
13:15:00.942  Attempting to locate the CodeCoverage.exe tool using setup configuration...
13:15:00.958  Code coverage command line tool: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe
13:15:00.958  Fetching code coverage report information from TFS...
13:15:00.958  Attempting to locate a test results (.trx) file...
13:15:00.989  Looking for TRX files in: C:\agent\_work\3\TestResults, C:\agent\_work\3\s\TestResults
13:15:00.989  Located a test results file: C:\agent\_work\3\s\TestResults\XYZBuild_PRODUCT_XYZ_2017-09-29_13_14_52.trx
13:15:00.989  One code coverage attachment was found in the trx file: PRODUCT_XYZ\XYZBuild_PRODUCT_XYZ 2017-09-29 13_14_45.coverage
13:15:00.989  Absolute path to coverage file: C:\agent\_work\3\s\TestResults\XYZBuild_PRODUCT_XYZ_2017-09-29_13_14_52\In\PRODUCT_XYZ\XYZBuild_PRODUCT_XYZ 2017-09-29 13_14_45.coverage
Unhandled Exception: System.ComponentModel.Win32Exception: The directory name is invalid
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at SonarQube.Common.ProcessRunner.Execute(ProcessRunnerArguments runnerArgs)
at SonarQube.TeamBuild.Integration.CoverageReportConverter.ConvertBinaryToXml(String converterExeFilePath, String inputBinaryFilePath, String outputXmlFilePath, ILogger logger)
at SonarQube.TeamBuild.Integration.CoverageReportConverter.ConvertToXml(String inputFilePath, String outputFilePath, ILogger logger)
at SonarQube.TeamBuild.Integration.CoverageReportProcessorBase.ProcessBinaryCodeCoverageReport(String binaryCoverageFilePath)
at SonarQube.TeamBuild.Integration.CoverageReportProcessorBase.ProcessCoverageReports()
at SonarQube.TeamBuild.PostProcessor.CoverageReportProcessor.ProcessCoverageReports()
at SonarQube.TeamBuild.PostProcessor.MSBuildPostProcessor.Execute(String[] args, AnalysisConfig config, ITeamBuildSettings settings)
at SonarQube.Bootstrapper.BootstrapperClass.PostProcess()
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)
System.Exception: Unexpected exit code received from batch file: 255
Processed: ##vso[task.logissue type=error;]System.Exception: Unexpected exit code received from batch file: 255
   at Microsoft.TeamFoundation.DistributedTask.Task.Internal.InvokeBatchScriptCmdlet.ProcessRecord()
   at System.Management.Automation.CommandProcessor.ProcessRecord()
The build was not triggered by a Pull Request, not processing code analysis comments
Invoke - Get-TaskVariable cmdlet
Variable read: MSBuild.SonarQube.Internal.IncludeFullReport = true
Invoke - Get-TaskVariable cmdlet
Variable read: MSBuild.SonarQube.Internal.ServerVersion =
Calling InvokeGetRestMethod "/api/server/version"
Invoke - Get-TaskVariable cmdlet
Variable read: MSBuild.SonarQube.HostUrl = https://sonarqube.test.domain.com/
Invoke - Get-TaskVariable cmdlet
Variable read: MSBuild.SonarQube.ServerUsername = ********
Invoke - Get-TaskVariable cmdlet
Variable read: MSBuild.SonarQube.ServerPassword =
GET https://sonarqube.test.domain.com/api/server/version with 0-byte payload
received 5-byte response of content type text/html;charset=utf-8
Processed: ##vso[task.setvariable variable=MSBuild.SonarQube.Internal.ServerVersion;]5.6.6
The SonarQube server version is 5.6.6
Waiting on the SonarQube server to finish processing in order to determine the quality gate status.
Invoke - Get-TaskVariable cmdlet
Variable read: Agent.BuildDirectory = C:\agent\_work\3
Could not find the task details file at C:\agent\_work\3\.sonarqube\out\.sonar\report-task.txt
System.Management.Automation.RuntimeException: Cannot determine if the analysis has finished. Possible cause: your SonarQube server version is lower than 5.3 - for more details see https://go.microsoft.com/fwlink/?LinkId=722407 ---> System.Management.Automation.RuntimeException: Cannot determine if the analysis has finished. Possible cause: your SonarQube server version is lower than 5.3 - for more details see https://go.microsoft.com/fwlink/?LinkId=722407
Processed: ##vso[task.logissue type=error;]System.Management.Automation.RuntimeException: Cannot determine if the analysis has finished. Possible cause: your SonarQube server version is lower than 5.3 - for more details see https://go.microsoft.com/fwlink/?LinkId=722407 ---> System.Management.Automation.RuntimeException: Cannot determine if the analysis has finished. Possible cause: your SonarQube server version is lower than 5.3 - for more details see https://go.microsoft.com/fwlink/?LinkId=722407
   --- End of inner exception stack trace ---
   at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
   at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
   at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at Microsoft.TeamFoundation.DistributedTask.Handlers.LegacyVSTSPowerShellHost.VSTSPowerShellHost.Main(String[] args)
LegacyVSTSPowerShellHost.exe completed with return code: -1.

我尝试使用我认为扫描仪正在使用的参数手动调用CodeCoverage.exe工具,并正确创建xml文件。

最后,我无法在此处创建问题:https://github.com/SonarSource/sonar-scanner-msbuild因此我假设它将从此处重新发布。

0 个答案:

没有答案