JetBrains Rider IDE fails to debug C# .NET Core unit tests with “CLR load callback is already in error state” error - versions 2019-2021

I'm running JetBrains Rider 2020.3.2 (though have tried with 2019 and 2021) and am attempting to debug into some .NET Core Xunit C# unit tests. Specifically, I have the following .NET versions installed:
 

Interestingly, when running the unit tests (without debugging), they run correctly. However, when attempting to debug them, I'm seeing the following error:

One or more errors occurred. (One or more errors occurred. (CLR load callback is already in error state. Value does not fall within the expected range. The error code is COR_E_ARGUMENT, or E_INVALIDARG, or WIN32_ERROR_INVALID_PARAMETER, or 0x80070057.))

I have researched this error and come up with the following potential remedies:

(Source: https://blog.jetbrains.com/dotnet/2017/06/16/rider-eap-23-net-core-debugger-back-code-cleanup/)

But this advice was written many years ago, and I do have the latest version of .NET Core. And I've tried many versions of Rider IDE.

How can I get my unit tests to be debuggable?

Please sign in to leave a comment.