当 VS 2019 中 运行 时,所有单元测试均无定论

All unit tests Inconclusive when run in VS 2019

我正在使用 Unit Test ExplorerUnit Test Sessions 进行 运行 我的测试,突然出现以下错误。

当在 Test -> Test explorer 中 运行 时,测试根本不会 运行,而且我没有看到任何错误。

在这两种情况下,Output window 中都没有任何内容。我重新安装了 R#,清除了 VS 缓存(在 %USERPROFILE%\AppData\Local\Microsoft 中),重新启动了 windows,重新启动了 VS。

2019.10.25 14:54:08.058   ERROR Remote: An exception occurred while invoking executor 'executor://mstestadapter/v2': Method not found: 'Void Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.set_CancellationTokenSource(System.Threading.CancellationTokenSource)'.

--- EXCEPTION #1/1 [LoggerException]
Message = “Remote: An exception occurred while invoking executor 'executor://mstestadapter/v2': Method not found: 'Void Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.set_CancellationTokenSource(System.Threading.CancellationTokenSource)'.”
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
HResult = COR_E_APPLICATION=80131600
StackTraceString = “
  at JetBrains.ReSharper.UnitTesting.MSTest.Provider.New.TestHost.TestHostMsTestRunner.TestExecutionEventHandler.HandleLogMessage(TestMessageLevel level, String message)
     at Microsoft.TestPlatform.VsTestConsole.TranslationLayer.VsTestConsoleRequestSender.SendMessageAndListenAndReportTestResults(String messageType, Object payload, ITestRunEventsHandler eventHandler, ITestHostLauncher customHostLauncher)
    (...)

我已经将整个解决方案中的NuGet包MSTest.TestAdapterMSTest.TestFramework更新到最新版本(v2.0.0),问题解决了。