Here is the error
Cannot evaluate expression because a thread is stopped at a point where garbage collection is impossible, possibly because the code
I was experiencing the same error message in the Visual Studio debugger when evaluating a linq expression.
Disabling the VS debugger config setting 'Enable Just My Code' resolved the issue for me:
To enable or disable Just My Code, choose the Tools > Options menu in Visual Studio. In the Debugging > General node, choose or clear Enable Just My Code.
https://docs.microsoft.com/en-us/visualstudio/debugger/just-my-code