You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
KeyNotFoundException if test session cancelled #6972
I'm not sure exactly how early in the process the test session needs to be cancelled, but when running some tests with MTP v2 and trying to cancel with CTRL+C, I got the following error logged to the terminal:
System.Collections.Generic.KeyNotFoundException: The given key 'c35ce0e4fb41425dadd0e345f4b0c534' was not present in the dictionary.
at System.Collections.Concurrent.ConcurrentDictionary`2.ThrowKeyNotFoundException(TKey key)
at System.Collections.Concurrent.ConcurrentDictionary`2.get_Item(TKey key)
at Microsoft.DotNet.Cli.Commands.Test.Terminal.TerminalTestReporter.AssemblyRunCompleted(String executionId, Int32 exitCode, String outputData, String errorData)
at Microsoft.DotNet.Cli.Commands.Test.TestApplicationHandler.OnTestProcessExited(Int32 exitCode, String outputData, String errorData)
at Microsoft.DotNet.Cli.Commands.Test.TestApplication.RunAsync()
at Microsoft.DotNet.Cli.Commands.Test.TestApplication.RunAsync()
at Microsoft.DotNet.Cli.Commands.Test.TestApplicationActionQueue.Read(BuildOptions buildOptions, TestOptions testOptions, TerminalTestReporter output, Action`1 onHelpRequested)
My guess would be that the runner knows a session ID, but the cancel took affect before it was actually created, so whatever it's looking for isn't in the dictionary.
Steps To Reproduce
Cancel dotnet test with CTRL+C early in the test session when MTP v2 is in use.
Martin Costello (@martincostello) Just to double check. Was this run simply a dotnet test? Or did it involve out-of-proc extensions, like hangdump or other out-of-proc extension?
Activity
Youssef1313 commentedon Nov 22, 2025
Duplicate of dotnet/sdk#51608
dotnet testfor MTP throws hard-to-interpret KeyNotFoundException dotnet/sdk#51608dotnet testfor MTP throws hard-to-interpret KeyNotFoundException dotnet/sdk#51608Youssef1313 commentedon Nov 22, 2025
Martin Costello (@martincostello) Just to double check. Was this run simply a
dotnet test? Or did it involve out-of-proc extensions, like hangdump or other out-of-proc extension?martincostello commentedon Nov 22, 2025
My end-state was with hang dumps being enabled, but it not sure at what point during iterating I was at when that happened.
Youssef1313 commentedon Nov 22, 2025
That aligns with my expectation of the bug as well.