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:

clip_image002

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?

2 comments:

Kristof Mattei said...

Registration is IEnumerable? Then you need a using to System.Linq in System.Core.dll (http://msdn.microsoft.com/en-us/library/bb338038(v=vs.110).aspx)

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

StarNamer said...

Turn on

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

See http://www.unknownerror.org/Problem/index/-1757610659/vs2013-debugger-entity-framework-ldquoruntime-has-refused-to-evaluate-the-expressionrdquo-crashes/