Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to Evaluate Expression - Visual Studio Debug Mode

I keep getting the following when trying to step through code and use the Immediate Window or Watch Window in Visual Studio.

Unable to Evaluate the Expression

I'm using Visual Studio 2008. Searching the forums there is a lot of talk of using the overloaded Response.Redirect and passing false to the endResponse parameter. I have tried that

I have also checked that my code is running the debug version and not the complied version.

I decided to start a brand new Windows Form Application with nothing on the form. In the Form Load event I declare a String and set a value to it. Stopping in there via a breakpoint I try and print the value of the String to the Immediate window and I still get 'Unable to Evaluate the Expression'

This has occurred all of a sudden. Regardless of any solution I open I am unable to use the Immediate window or watch windows to determine values in the code.

I'm not sure If a setting in Visual Studio has changed?

like image 694
David Avatar asked Sep 20 '10 05:09

David


People also ask

How do you start a Debug session to evaluate expressions?

To open the Debug Console, use the Debug Console action at the top of the Debug pane or use the View: Debug Console command (Ctrl+Shift+Y). Expressions are evaluated after you press Enter and the Debug Console REPL shows suggestions as you type.

How do I get out of debug mode in Visual Studio?

To end a debugging session in Microsoft Visual Studio, from the Debug menu, choose Stop Debugging.

Why is my debugger not working in Vscode?

Debugger not working Look at the debugger console for any error messages displayed. Look at the Debugger Tools console output for any errors. Remember to re-start VS Code once done (this won't be necessary in a future release). Solution: Clear all expressions from the debugger Watch window and start debugging again.


2 Answers

Tools -> Options -> Debugging -> General -> Enable Just My Code

If the option is not ticked, then I get "Unable to evaluate the expression".

If I tick the option AND restart visual studio (this is the crucial bit) it fixes the problem for me.

like image 98
Tim Gradwell Avatar answered Oct 14 '22 17:10

Tim Gradwell


I had this issue with Visual Studio 2012, and fixed it just resetting settings: "Unable to evaluate the expression" in Visual Studio 2012 Debug Mode

like image 2
Luciano Avatar answered Oct 14 '22 17:10

Luciano