nunit3-vs-adapter: .NET Core 3.1 KeyNotFoundException, Unable to find UniqueTest VSTestAdapter

========== Discovery finished: 120 tests found (0:00:01.4609728) ==========
System.Collections.Generic.KeyNotFoundException: Unable to find UniqueTest VSTestAdapter,D:\path_to_file\bin\Debug\netcoreapp3.1\MyFile.Tests.dll,MyFile.Tests.Services.ClassNameTests.ExtractUnitNumber_Success,:0a4559b4-6ae5-7f70-0224-19d70ce93653
   at Microsoft.VisualStudio.TestStorage.TestStoreHierarchyNode.LookupUniqueTest(MergedTestIndex index)
   at Microsoft.VisualStudio.TestStorage.TestStoreHierarchyIndex.<>c__DisplayClass41_0.<GetTestContainersForNodes>b__0(TestStoreHierarchyNode ct)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at Microsoft.VisualStudio.TestStorage.TestStore.UpdateContainerConfigs(IDictionary`2 allContainerConfigs, IEnumerable`1 containers, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.TestStorage.TestStore.GetTestContainersForNodes(Int32 viewId, IEnumerable`1 nodeIds, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.TestWindow.Host.TestWindowStoreService.<>c__DisplayClass34_0.<GetTestSourcesAsync>b__0()
   at Microsoft.VisualStudio.TestWindow.Extensibility.ILoggerExtensions.<CallWithCatchAsync>d__10`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.VisualStudio.TestWindow.Controller.TestContainerConfigurationQueryByTestsBase.<QueryTestContainerConfigurationsAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.TestWindow.Controller.TestContainerConfigurationQuery.<GetTestContainerConfigurationsAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.TestWindow.Controller.TestRunConfiguration.<UpdateAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.TestWindow.Controller.RunOperation.<RunTestsAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.TestWindow.Controller.Operation.<<Execute>b__37_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.TestWindow.Extensibility.ILoggerExtensions.<CallWithCatchAsync>d__10`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
  • NUnit: 3.12.0
  • NUnit3TestAdapter: 3.16.0
  • Framework: netcoreapp3.1

I was on .NET Core 2.2 before and it worked fine. Is there anything preventing 3.1 from running these tests in VS2019 ?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 31 (13 by maintainers)

Most upvoted comments

@OsirisTerje , ah, sorry, now I realize the package information, relating to my local folders, is in the .csproj file.

Indeed I have xUnit but the error I got was the exact same and I couldn’t find anything on the 'Net about it, so I thought to post here. 😃

EDIT: In case anyone with xUnit and the same exception stumbles upon this, let it be known that in my case installing this nUnit adapter fixed the xUnit problem (even after uninstalling the nUnit adapter).
¯\_(ツ)_/¯

The exception is fixed in the upcoming 16.5 Preview -2, which should be out real soon now 😃