无法使用 Visual Studio 2019 分析代码覆盖率

Can't analyze code coverage with Visual Studio 2019

我正在使用 Visual Studio 2019 开发和测试 .NET Core 应用程序。几个月前,我记得我所有的测试都成功了,我能够启动代码覆盖率分析。今天我启动了一个代码覆盖率分析,但它失败了(测试总是成功的):

Empty results generated: No binaries were instrumented. Make sure the tests ran, required binaries were loaded, had matching symbol files, and were not excluded through custom settings. For more information see https://go.microsoft.com/fwlink/?LinkID=253731

我一直在升级我的 Visual Studio,我现在的当前版本是 Microsoft Visual Studio Enterprise 2019(版本 16.4.0)

关于这个问题有任何经验或反馈吗?

奇怪的是,将 "Processor Architecture" 设置为 x64 对我有用:

查看截图

就我而言,使用全新安装的 VS 2019 Enterprise 和一个包含两个项目的简单解决方案:

  • 静态库
  • 本机单元测试项目(测试上面的库)

我遇到了同样的错误"Empty results generated: No binaries were instrumented. Make sure the tests ran, required binaries were loaded, had matching symbol files, and were not excluded through custom settings."

解决方案是在本机单元测试项目的链接器部分启用 "Profile"