Skip to content

dotnet test for MTP throws hard-to-interpret KeyNotFoundException #51608

@Youssef1313

Description

@Youssef1313

So far I saw it only once, but I think it's worth investigating:

The following exception occurred when running the test module with RunCommand '/Users/runner/work/1/s/artifacts/bin/Microsoft.Testing.Extensions.UnitTests/Debug/net9.0/Microsoft.Testing.Extensions.UnitTests' and RunArguments '  --diagnostic --diagnostic-output-directory /Users/runner/work/1/s/artifacts/log/Debug --diagnostic-file-prefix Microsoft.Testing.Extensions.UnitTests_net9.0_Debug_x64 --diagnostic-verbosity trace --crashdump --hangdump --hangdump-timeout 15m --report-azdo --coverage --coverage-settings /Users/runner/work/1/s/test/coverage.config --coverage-output Microsoft.Testing.Extensions.UnitTests_net9.0_Debug_x64.coverage --report-trx --report-trx-filename Microsoft.Testing.Extensions.UnitTests_net9.0_x64.trx --results-directory /Users/runner/work/1/s/artifacts/TestResults/Debug/':

System.Collections.Generic.KeyNotFoundException: The given key 'ba98a3b7d1b0470a866ea837070091b8' 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)

In addition, this exception was just buried somewhere in the middle of the output and wasn't surfaced towards the end of the output.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions