Search code examples
mstest.net-4.8

NuGet MSTest.TestAdapter.3.0.0 crashes in .Net "Framework" 4.8


Edited: as @Diego Malanij pointed out in answer https://stackoverflow.com/a/74768591/4489263 it's the MSTest.TestAdapter 3.0.0 package causing the following observed misbehavior, whereas MSTest.TestFramework 3.0.0 works well

After updating NuGet packages in a .Net 4.8 solution, MS UnitTests just reproducibly stopped working here in Visual Studio 2022 "Community Edition" on Windows 10 without having changed anything in the custom solution itself. The same update(s) work well in a .Net6.0 solution

UnitTests

Updates:

MSTest.TestFramework.2.2.10 -> MSTest.TestFramework.3.0.0
MSTest.TestAdapter.2.2.10 -> MSTest.TestAdapter.3.0.0

The Output window in the .Net4.8 solution shows exceptions, and the Test Explorer says:

UnitTests
  Tests in group: 134

Outcomes
   134 Not Run

Output Window :

========== Test run finished: 0 Tests (0 Passed, 0 Failed, 0 Skipped) run in 127 ms ==========

Log level is set to Informational (Default). Source code repository not available. Some features may not work as expected. Connected to test environment '< Local Windows Environment >' Test data store opened in 0,139 sec. ========== Starting test discovery ========== No test is available in D:\Dev.Net\ProdSW\RingManager\RingManager\RingManager.Data\bin\Debug\RingManager.Data.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. No test is available in D:\Dev.Net\ProdSW\RingManager\RingManager\RingManager\bin\Debug\RingManager.exe. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. No test is available in D:\Dev.Net\ProdSW\RingManager\RingManager\RingManager.CommonViews\bin\Debug\RingManager.CommonViews.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. No test is available in D:\Dev.Net\ProdSW\RingManager\RingManager\RingManager.Common\bin\Debug\RingManager.Common.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. ========== Test discovery finished: 134 Tests found in 3 sec ========== ========== Starting test run ========== ========== Test run finished: 134 Tests (134 Passed, 0 Failed, 0 Skipped) run in 16,7 sec ========== Starting test discovery for requested test run ========== Starting test discovery ========== ========== Test discovery finished: 134 Tests found in 1,7 sec ========== ========== Starting test run ========== An exception occurred while invoking executor 'executor://mstestadapter/v2': Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Stack trace: at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.TestDeployment.GetDeploymentInformation(String source) at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.ExecuteTestsInSource(IEnumerable1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle, String source, Boolean isDeploymentDone) at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.ExecuteTests(IEnumerable1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle, Boolean isDeploymentDone) at 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) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.RunTestsWithTests.InvokeExecutor(LazyExtension2 executor, Tuple2 executorUri, RunContext runContext, IFrameworkHandle frameworkHandle) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.<>c__DisplayClass46_0.b__0() at Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.<>c__DisplayClass0_0.b__0() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(Action action, PlatformApartmentState apartmentState, Boolean waitForCompletion) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.TryToRunInStaThread(Action action, Boolean waitForCompletion) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.RunTestInternalWithExecutors(IEnumerable`1 executorUriExtensionMap, Int64 totalTests)

========== Test run finished: 0 Tests (0 Passed, 0 Failed, 0 Skipped) run in 127 ms ==========

After reverting the changes via version control system - and restarting VS - all is back to normal. So I guess I'll wait a little and then might try again with a next NuGet version, and this is more a warning than a question asking for help


Solution

  • MSTest.TestAdapter.3.0.1 now being available apparently cures the symptom, may have been a temporary bug in its version 3.0.0. After installing NuGet

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

    ... all seems to be okay again