Cannot evaluate expression because a thread is stopped at a point where garbage collection is impossible

If your project is compiled in release (with optimizations turned on), you may see this. Have you tried the DEBUG configuration?


This error fires only when you are trying to use Watch dialog during debug. Try to use some other technique to output the variables, like Debug.WriteLine, Console.WriteLine and so on.


None of the answers solved my problem so I'm posting the solution that helped me.

"If there is to much data in the parameters then this error can occure, a simple solution is to make an object, not a struct because that's a dataobject.

Put this object in your parameters instead of all the different variables, normally the problem will no longer take place."

Tags:

C#

.Net

Linq