gpt4 book ai didi

azure - 封面覆盖率报告导致 Microsoft.VisualStudio.Coverage.VanguardException

转载 作者:行者123 更新时间:2023-12-03 01:23:17 26 4
gpt4 key购买 nike

我正在尝试将 Cobertura 报告生成集成到我的 azure 管道中。为此,我在 .Net core 测试项目中添加了 coverlet.collector 3.0.3。以下是我用于测试运行的 yaml 命令

- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: test
projects: '**/*Test/*.csproj'
arguments: '--collect:"XPlat Code Coverage" --settings CodeCoverage.runsettings --logger trx'
publishTestResults: false

我使用 Reportgenerator 任务来合并和发布覆盖率报告。这一切在我的代码的一个分支(一个旧分支,我不久前开始在其上设置管道)中运行良好。但是当我试图指向管道中的最新分支时,我收到如下错误

Data collector 'Code Coverage' message: Data collector caught an exception of type 'Microsoft.VisualStudio.Coverage.VanguardException': 'Running event not received from CodeCoverage.exe. Check eventlogs for failure reason

我已经检查了两个分支中的几乎所有内容,Microsoft.Net.Test.SDK,coverlet.collector,两者都是相同的版本。我不确定两个分支之间有什么区别,以及我应该在两个代码分支之间寻找什么差异,这可能会导致此类问题。

下面添加了成功和失败的完整日志。

成功(使用旧分支时)

C:\windows\system32\chcp.com 65001
Active code page: 65001
Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version.
"C:\Program Files\dotnet\dotnet.exe" test I:\Agent-Win-R_work\489\s\XXXX.Business.Test\XXXX.Business.Test.csproj "--collect:XPlat Code Coverage" --settings CodeCoverage.runsettings --logger trx
Test run for I:\Agent-Win-R_work\489\s\XXXX.Business.Test\bin\Debug\netcoreapp3.1\XXXXWeb.Business.Test.dll(.NETCoreApp,Version=v3.1)
Microsoft (R) Test Execution Command Line Tool Version 16.5.0
Copyright (c) Microsoft Corporation. All rights reserved.

Starting test execution, please wait...

A total of 1 test files matched the specified pattern.
Microsoft (R) Coverage Collection Tool Version 16.0.30319.3002

Copyright (c) Microsoft Corporation. All rights reserved.

Results File: I:\Agent-Win-R_work\489\s\XXXX.Business.Test\TestResults\SVCGIDETFSProdBld01_MP-GIDE-522C_2021-07-01_04_18_04.trx

Attachments:
I:\Agent-Win-R_work\489\s\XXXX.Business.Test\TestResults\5f62864f-6c2c-4188-ac02-0dc536b464b3\coverage.cobertura.xml
I:\Agent-Win-R_work\489\s\XXXX.Business.Test\TestResults\5f62864f-6c2c-4188-ac02-0dc536b464b3\SVCGIDETFSProdBld01_MP-GIDE-522C_2021-07-01.04_17_58.coverage
Test Run Successful.
Total tests: 6
Passed: 6
Total time: 3.8813 Seconds

失败(当指向新分支时)

C:\windows\system32\chcp.com 65001
Active code page: 65001
Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version.
"C:\Program Files\dotnet\dotnet.exe" test I:\Agent-Win-R_work\489\s\XXXX.Test\XXXXBusiness.Test.csproj "--collect:XPlat Code Coverage" --settings CodeCoverage.runsettings --logger trx
Test run for I:\Agent-Win-R_work\489\s\XXXX.Business.Test\bin\Debug\netcoreapp3.1\XXXXWeb.Business.Test.dll(.NETCoreApp,Version=v3.1)
Microsoft (R) Test Execution Command Line Tool Version 16.5.0
Copyright (c) Microsoft Corporation. All rights reserved.

Starting test execution, please wait...

A total of 1 test files matched the specified pattern.
Data collector 'Code Coverage' message: Data collector caught an exception of type 'Microsoft.VisualStudio.Coverage.VanguardException': 'Running event not received from CodeCoverage.exe. Check eventlogs for failure reason.'. More details: ..
Results File: I:\Agent-Win-R_work\489\s\XXXX.Business.Test\TestResults\SVCGIDETFSProdBld01_MP-GIDE-522C_2021-07-01_04_12_42.trx

Attachments:
I:\Agent-Win-R_work\489\s\XXXX.Business.Test\TestResults\3839c24a-e17d-4d0d-9953-359388d5a940\coverage.cobertura.xml
Test Run Failed.
Total tests: 6
Passed: 6

我也遇到过这个问题:https://github.com/microsoft/azure-pipelines-agent/issues/2839用户怀疑这是代理升级问题,但对我来说似乎并非如此,因为我能够为一个代码分支成功运行它。

如有任何建议或指导,我们将不胜感激。

最佳答案

当我向 Coverlet 团队提出这个问题时,我得到了他们的快速回复。他们注意到了一些我完全错过的事情。

Microsoft (R) Coverage Collection Tool Version 16.0.30319.3002

这出现在我的成功日志中,这意味着 Microsoft 代码覆盖率与 Coverlet 代码覆盖率并行运行。他们怀疑,如果同时运行两个代码覆盖率收集器,并且两个分支中运行测试的方式之间的某些计时问题会导致不同的行为,我们可能会遇到一些奇怪的错误。

当我在 .runsettings 文件中禁用 Microsoft 代码覆盖率后,问题就得到了解决

之前:

 <DataCollector friendlyName="XPlat code coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

现在

<DataCollector friendlyName="XPlat code coverage">

关于azure - 封面覆盖率报告导致 Microsoft.VisualStudio.Coverage.VanguardException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68211936/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com