nunit / nunit3-vs-adapter

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

Latest VS 2022 17.8.0 Release Causing Issues with Test Adaptor #1137

Closed hcornelisonJHA closed 8 months ago

hcornelisonJHA commented 8 months ago

.NET Framework 4.7.2 Test Project, the Test Adaptor does not find any tests to run. They are listed in the Test Explorer, but clicking Run or Debug does nothing. This seemed to start happening immediately after updating from VS 2022 17.7.x to the latest 17.8.0.

I saw this initially when I opened Test Explorer: 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

Now I only see this when I try to run tests: Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.

OsirisTerje commented 8 months ago

@hcornelisonJHA That is weird.

Just tried it with Issue618 (see https://github.com/nunit/nunit3-vs-adapter.issues/tree/master/Issue618) which I updated to match yours, and it worked as it should.

  1. Can you delete the .vs folder, and retry?

  2. If 1) doesn't help, then can you please upload a repro project?

You can a) Add it as a PR to https://github.com/nunit/nunit3-vs-adapter.issues, add it as a separate folder named IssueXXX where the XXX is the issue number, or b) Add it as a zipped attachment here , or c) Add it to your own repo and just post the link.

Make it as small as you can, it should compile "as is".

hcornelisonJHA commented 8 months ago

Good Suggestion @OsirisTerje!

I blew away all of the .vs folders in my entire directory tree and it seems to have resolved the problem.

Little PowerShell to do the trick... Get-ChildItem -Include .vs -Recurse -Force | Remove-Item -Force -Recurse

Thanks!

hcornelisonJHA commented 8 months ago

My success was short lived and I still continued to have the issue following the removal of the .vs folders. It seemed as though it work temporarily, but closing and opening VS again, the issue persisted.

I instead took my .NET Framework 4.7.2 projects and converted all of them to the new SDK Style project format. After that was complete, the tests ran fine on the new 17.8.0 version of VS, and continued to work for my colleagues running older versions of VS 2022.

OsirisTerje commented 8 months ago

@hcornelisonJHA That sounds like an issue that should be reported to Microsoft.
But I believe their response might be exactly what you have done :-)