NuGet MSTest.TestAdapter.3.0.0 在 .Net "Framework" 4.8 中崩溃



编辑:正如@Diego Malanij在回答中指出的那样https://stackoverflow.com/a/74768591/4489263是MSTest.TestAdapter 3.0.0包导致了以下观察到的不当行为,而MSTest.Test Framework 3.0.0运行良好

在.Net 4.8解决方案中更新NuGet包后,MS UnitTests在Visual Studio 2022中可复制地停止了工作;社区版";在Windows 10上,而没有更改自定义解决方案本身的任何内容。相同的更新在.Net 6.0解决方案中运行良好

UnitTests
Updates:
MSTest.TestFramework.2.2.10 -> MSTest.TestFramework.3.0.0
MSTest.TestAdapter.2.2.10 -> MSTest.TestAdapter.3.0.0

Net4.8解决方案中的Output窗口显示异常,Test Explorer显示:

UnitTests
Tests in group: 134
Outcomes
 134 Not Run

输出窗口:

=========测试运行完成:127毫秒内运行0个测试(0个通过,0个失败,0个跳过)======

日志级别设置为"信息"(默认值)。源代码存储库不可用。某些功能可能无法按预期工作。已连接到测试环境'<本地Windows环境>'测试数据存储在0139秒内打开。==========开始测试发现==========D:\Dev.Net\ProdSW\RingManager\RingManager/RingManager.Data.dll中没有可用的测试。请确保测试发现程序&遗嘱执行人已注册,平台&框架版本设置合适,请重试。D:\Dev.Net\ProdSW\RingManager\RingManager/RingManager\bin\Debug\RingManager.exe中没有可用的测试。请确保测试发现者&遗嘱执行人已注册,平台&框架版本设置合适,请重试。D:\Dev.Net\ProdSW\RingManager\RingManager/RingManager.CommonViews.dll中没有可用的测试。请确保测试发现者&遗嘱执行人已注册,平台&框架版本设置合适,请重试。D:\Dev.Net\ProdSW\RingManager\RingManager/RingManager.Common.dll中没有可用的测试。请确保测试发现程序&遗嘱执行人已注册,平台&框架版本设置合适,请重试。===========测试发现已完成:3秒内发现134个测试=====================开始测试运行================测试运行已完成:在16.7秒内运行134个测试(134个通过,0个失败,0个跳过)==========正在为请求的测试运行启动测试发现==========开始测试发现=====================测试发现已完成:在1.7秒内发现134个测试=====================开始测试运行==========调用executor时发生异常executor://mstestadapter/v2":无法加载文件或程序集"Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions,Version=14.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"或其依赖项之一。系统找不到指定的文件。堆栈跟踪:位于Microsoft.VisualStudio.TestPlatform.MSTAdapter.PlatformServices.TestDeployment.GetDeploymentInformation(字符串源)位于Microsoft.VisualStudio.TestPlatform.MTest.TestAdapter.Execution.TestExecutionManager.ExecuteTestsInSource(IEnumerable1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle, String source, Boolean isDeploymentDone) at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.ExecuteTests(IEnumerable测试、IRunContext runContext、IFrameworkHandle frameworkHandle、Boolean isDeploymentDone)位于Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.RunTests(IEnumerable1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle, TestRunCancellationToken runCancellationToken) at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.MSTestExecutor.RunTests(IEnumerable1 tests,IRunContext runContext,IFrameworkHandle frameworkHandle)位于Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.RunTestsWithTests.InvokeExecutior(LazyExtension2 executor, Tuple2 executeUri,RunContext RunContext,IFrameworkHandle frameworkHandle)位于Microsoft.VisualStudio.TestPlatform.CrosPlatEngine.Execution.BaseRunTests。<gt;c__DisplayClass46_0.b_0()位于Microsoft.VisualStudio.TestPlatformAbstractions.PlatformThread。<gt;c__DisplayClass0_0.b_0()---从引发异常的前一位置开始的堆栈结尾跟踪---在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Sthrow()位于Microsoft.VisualStudio.TestPlatformAbstractions.PlatformThread.Run(Action Action,PlatformApartmentState apartmentState,Boolean waitForCompletion)位于Microsoft.VisualStudio.TestPlatform.CrosPlatEngine.Execution.BaseRunTests.TryToRunInStaThread(Action Action,Boolean waitForCompletion)位于Microsoft.VisualStudio.TestPlatform.CrosPlatEngine.Execution.BaseRunTests.RunTestInternalWithExecutitors(IEnumerable`1executorUriExtensionMap,Int64 totalTests)

=========测试运行完成:127毫秒内运行0个测试(0个通过,0个失败,0个跳过)======

通过版本控制系统恢复更改并重新启动VS后,一切恢复正常所以我想我会等一段时间,然后可能会用下一个NuGet版本再试一次,这更多的是一个警告,而不是一个寻求帮助的问题

我在解决方案中发现了同样的问题。今天,我能够使用fusion日志进行更深入的挖掘,问题是在appbase中搜索程序集以查找testhost,而不是单元测试输出本身的位置(意思是bindebugbinrelease)。

我看了一下MSTest.TestAdapter包本身及其道具。。。它改变了以前版本的结构,现在它包含Microsoft.VisualStudio.TestPlatform.TestFramework程序集(从packagesMSTest.TestAdapter.3.0.0buildnet462位置加载),但没有扩展。

我尝试在该位置复制丢失的dll,测试执行成功,但这显然不是一个解决方案。

就我而言,这是Visual Studio 2019,我认为2022年可能会解决这个问题,但很明显,在找到你的帖子后,情况并非如此;稍后我将尝试进一步分析,但目前唯一的选择是不更新MSTest.TestAdapter包(MSTest.TestFramwork3.0时很好)。

MSTest.TestAdapter.3.0.1现在可用,显然可以治愈症状,可能是其版本3.0.0中的一个临时错误。安装NuGet 后

Updates:
MSTest.TestFramework.3.0.0 -> MSTest.TestFramework.3.0.1
MSTest.TestAdapter.2.2.10 -> MSTest.TestAdapter.3.0.1

一切似乎又好起来了

最新更新