Wednesday, January 15, 2014

Visual Studio error: The runtime has refused to evaluate the expression at this time

To debug an issue inside one of my applications, I added a conditional breakpoint and used the following expression ‘container.Registrations.Count() <10’.

No luck however… When I tried to run the application Visual Studio started to complain and showed the following error message:


No idea why this doesn’t work Bedroefde emoticon

Anyone who knows how to fix this or has an explanation why it doesn’t work?


Kristof Mattei said...

Registration is IEnumerable? Then you need a using to System.Linq in System.Core.dll (

If it's a list/array, you should omit the ().

StarNamer said...

Turn on

Tools -> Options -> Debugging -> General -> Use Managed Compatibility Mode