testfx: MSTest 3.0.0 is broken when targeting .NET Framework 4.8

Describe the bug

Steps To Reproduce

  1. Create UnitTest project in Visual Studio 2022.
  2. Make sure target framework is .NET Framework 4.8.
  3. Build and execute unit tests.

Expected behavior

Tests execute.

Actual behavior

Tests do not execute.

Additional context

See attached sample project TestProject1.zip.

Tests output:

Log level is set to Informational (Default).
Connected to test environment '< Local Windows Environment >'
Source code repository not available. Some features may not work as expected.
Test data store opened in 0.038 sec.
Downloaded solution cache containers in 0.112 sec.
Loaded 0 test records from 0 solution cache containers in 0.279 sec.
========== Starting test discovery ==========
========== Test discovery finished: 1 Tests found in 3.6 sec ==========
Test data store opened in 0.016 sec.
========== Starting test discovery ==========
========== Test discovery skipped: All test containers are up to date ==========
Building Test Projects
========== 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(IEnumerable`1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle, String source, Boolean isDeploymentDone)
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.ExecuteTests(IEnumerable`1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle, Boolean isDeploymentDone)
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.RunTests(IEnumerable`1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle, TestRunCancellationToken runCancellationToken)
   at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.MSTestExecutor.RunTests(IEnumerable`1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.RunTestsWithTests.InvokeExecutor(LazyExtension`2 executor, Tuple`2 executorUri, RunContext runContext, IFrameworkHandle frameworkHandle)
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.<>c__DisplayClass46_0.<RunTestInternalWithExecutors>b__0()
   at Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.<>c__DisplayClass0_0.<Run>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 217 ms ==========

AB#1696392

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 5
  • Comments: 18 (8 by maintainers)

Most upvoted comments

Hi @arvindshmicrosoft, we are testing the version internally at the moment. I hope to be able to release this week.

Hey there. I have a fix on-going but in the meantime you can disable AppDomain (if that’s ok for your tests) and it will workaround the issue. Here is a full example of a runsettings to use to disable appdomains:

<RunSettings>   
	<RunConfiguration>  
		<DisableAppDomain>True</DisableAppDomain>   
	</RunConfiguration>  
</RunSettings>

Filed a new bug #1493.

@Evangelink, updated sample project. Build and execute tests by running the following command from the solution folder:

"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe" TestProject1\bin\Debug\net48\TestProject1.dll /Settings:"TestProject1\local.runsettings" /TestAdapterPath:TestProject1\bin\Debug\net48

TestProject1.zip

Hey all, we just released MSTest 3.0.1.

I’m not the reporter, but I can say that the runsettings workaround did work for my project.