question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MSTest 3.0.0 is broken when targeting .NET Framework 4.8

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Reactions:5
  • Comments:18 (8 by maintainers)

github_iconTop GitHub Comments

6reactions
Evangelinkcommented, Dec 19, 2022

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

5reactions
Evangelinkcommented, Dec 7, 2022

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>
Read more comments on GitHub >

github_iconTop Results From Across the Web

NuGet MSTest.TestAdapter.3.0.0 crashes in .Net " ...
Today I was able to dig a bit deeper with fusion log and the problem is that the assembly is being searched in...
Read more >
Troubleshoot .NET Framework targeting errors
This article provides resolutions for MSBuild errors that might occur because of reference issues.
Read more >
too particular about .NET Core runtime version
Test Explorer recently stopped running my unit tests on the .NET Core ... The following frameworks were found: 3.0.0 at [C:\Program Files ...
Read more >
Solution to Visual Studio 2022 messing up ...
The error shown when attempting to load the projects was: The project file cannot be opened. Unable to locate the .NET SDK. Check...
Read more >
MSTest.TestFramework 3.1.1
MSTest is Microsoft supported Test Framework. This package includes the libraries for writing tests with MSTest. To ensure discovery and execution of your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found