skip to Main Content

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.NetProdSWRingManagerRingManagerRingManager.DatabinDebugRingManager.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.NetProdSWRingManagerRingManagerRingManagerbinDebugRingManager.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.NetProdSWRingManagerRingManagerRingManager.CommonViewsbinDebugRingManager.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.NetProdSWRingManagerRingManagerRingManager.CommonbinDebugRingManager.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

2

Answers


  1. Chosen as BEST ANSWER

    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


  2. I’ve found the same issue with my solution. Today I was able to dig a bit deeper with fusion log and the problem is that the assembly is being searched in the appbase for the testhost, rather than the location of the unit test output itself (meaning bindebug or binrelease).

    I’ve taken a look at the MSTest.TestAdapter package itself and its props… it has changed the structure regarding the previous version, and now it contains the Microsoft.VisualStudio.TestPlatform.TestFramework assembly (which is loaded from the packagesMSTest.TestAdapter.3.0.0buildnet462 location), but the extensions are no there.

    I tried copying the missing dll in that location and tests execution succeeded, however that’s clearly not a solution.

    In my case this is with Visual Studio 2019, and I thought 2022 might have this solved but clearly after finding your post, that’s not the case; I’ll try to go a bit further with the analysis later, but as for now the only option is not updating the MSTest.TestAdapter package (the MSTest.TestFramwork is fine at 3.0.0).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search