nunit / nunit3-vs-adapter

NUnit 3.0 Visual Studio test adapter for use under VS 2012 or later
https://nunit.org
MIT License
203 stars 105 forks source link

Release adapter version which embeds engine 3.16.2 #1056

Closed madelson closed 1 year ago

madelson commented 1 year ago

I installed .NET 8 preview and my NUnit .NET framework tests now fail with this issue, but for .NET 8:

NUnit Adapter 4.3.1.0: Test discovery starting
Exception System.TypeInitializationException, Exception thrown discovering tests in C:\Users\mikea_000\Documents\Interests\CS\MedallionShell\MedallionShell.Tests\bin\Release\net46\MedallionShell.Tests.dll
The type initializer for 'NUnit.Engine.Services.RuntimeFrameworkService' threw an exception.
   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 97
   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 8.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.FindAvailableFrameworks()
   at NUnit.Engine.RuntimeFramework.get_AvailableFrameworks()
   at NUnit.Engine.Services.RuntimeFrameworkService..cctor()
NUnit Adapter 4.3.1.0: Test discovery complete

While this PR comment says that this should be fixed in Engine 3.16, The docs say that the latest adapter only brings in engine 3.15.2. Could we have a new adapter release which embeds engine 3.16 to fix this?

stevenaw commented 1 year ago

Thanks for raising this @madelson I'm not heavily involved with the adapter project but I suspect this may already be tracked under https://github.com/nunit/nunit3-vs-adapter/issues/1049. Luckily, that issue is slated for the next milestone which means this should be fixed with the next minor release. Sorry, but based on what @OsirisTerje has mentioned there you may need to uninstall .NET8 in the meantime to be able to use the adapter. Alternately, if it's an option for you in the interim, I believe 3.16.2 is the latest release of the console runner and should be using version 3.16.2 of the engine which may work for you.

I'm going to close this as a duplicate, but note that we will be able to see any follow-up questions or comments.

madelson commented 1 year ago

Thanks @stevenaw . I'll watch that issue.

OsirisTerje commented 1 year ago

@madelson Version 4.4.0-beta.1 is out now https://www.nuget.org/packages/NUnit3TestAdapter/4.4.0-beta.1 . It includes support for .net 8.
It contains the engine version 3.16.3. Appreciate it if you have the time to verify it works as it should. Once verification is done, the non-beta will be published.

madelson commented 1 year ago

Thanks @OsirisTerje . I just installed it and it works like a charm!