Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to run NUnit tests after upgrading to VS2022 17.4.0

After updating VS Pro 2022 to the newest available version 17.4.0, I am no longer able to run any NUnit tests in one of my VS solutions. The test explorer correcly displays the list of tests, however, none of them are actually executing. I can see that some warnings are accumulating, here's the printout:

========== Starting test discovery ==========
Test project TestHelpers does not reference any .NET NuGet adapter. Test 
discovery or execution might not work for this project.
It's recommended to reference NuGet test adapters in each test project in the solution.
Test project TestHelper.NUnitAssert does not reference any .NET NuGet 
adapter. Test discovery or execution might not work for this project.
It's recommended to reference NuGet test adapters in each test project in the solution.
Test project TestHelper.AutoData does not reference any .NET NuGet adapter. 
Test discovery or execution might not work for this project.
It's recommended to reference NuGet test adapters in each test project in the solution.
Test project TestHelpers.Data does not reference any .NET NuGet adapter. 
Test discovery or execution might not work for this project.
It's recommended to reference NuGet test adapters in each test project in the solution.
NUnit Adapter 4.2.0.0: Test discovery starting
NUnit Adapter 4.2.0.0: Test discovery starting
NUnit Adapter 4.2.0.0: Test discovery starting
NUnit Adapter 4.2.0.0: Test discovery starting
NUnit Adapter 4.2.0.0: Test discovery starting
Exception System.TypeInitializationException, Exception thrown discovering tests in C:\Projects\MyProj\TestProjects\TestHelpers\bin\Debug\TestHelpers.dll
The type initializer for 'NUnit.Engine.Services.RuntimeFrameworkService' threw an exception.
NUnit Adapter 4.2.0.0: Test discovery starting
at NUnit.Engine.Services.RuntimeFrameworkService.ApplyImageData(TestPackage package)
at NUnit.Engine.Services.RuntimeFrameworkService.SelectRuntimeFramework(TestPackage package)
at NUnit.Engine.Runners.MasterTestRunner.GetEngineRunner()
at NUnit.Engine.Runners.MasterTestRunner.Explore(TestFilter filter)
at NUnit.VisualStudio.TestAdapter.NUnitEngine.NUnitEngineAdapter.Explore(TestFilter filter) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitEngine\NUnitEngineAdapter.cs:line 88
at NUnit.VisualStudio.TestAdapter.NUnit3TestDiscoverer.DiscoverTests(IEnumerable`1 sources, IDiscoveryContext discoveryContext, IMessageLogger messageLogger, ITestCaseDiscoverySink discoverySink) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnit3TestDiscoverer.cs:line 82
InnerException: System.ArgumentException: Unknown framework version 7.0
Parameter name: version
at NUnit.Engine.RuntimeFramework.GetClrVersionForFramework(Version frameworkVersion)
at NUnit.Engine.RuntimeFramework..ctor(RuntimeType runtime, Version version, String profile)
at NUnit.Engine.RuntimeFramework.GetNetCoreRuntimesFromDirectoryNames(IEnumerable`1 dirNames)
at NUnit.Engine.RuntimeFramework.FindDotNetCoreFrameworks()
at NUnit.Engine.RuntimeFramework.get_AvailableFrameworks()
at NUnit.Engine.Services.RuntimeFrameworkService..cctor()
NUnit Adapter 4.2.0.0: Test discovery complete

Rolling back to previously used version 17.3.6 seems to fix the issue.

Perhaps anyone encountered a similar issue?

like image 883
RollerMobster Avatar asked Jan 23 '26 00:01

RollerMobster


1 Answers

Managed to resolve the issue by upgrading NUnit3TestAdapter to version 4.3.0 as per recomendations in here: https://github.com/nunit/nunit3-vs-adapter/issues/987

Also, had to add NUnit3TestAdapter nuget to the four TestHelpers projects which are mentioned in the log.

like image 165
RollerMobster Avatar answered Jan 25 '26 18:01

RollerMobster



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!