David
David

Reputation: 1293

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?

Upvotes: 10

Views: 15472

Answers (4)

Michel de Ruiter
Michel de Ruiter

Reputation: 7954

If you happen to be in a VB.NET project, things are a bit confusing. The Memory window shows the address in C(++)/C# syntax (for instance 0x000002287A44BDB0). But you have to type Basic syntax (&H000002287A44BDB0)!

Even when you just press Enter inside the Address textbox on the existing value, you will get:

Unable to evaluate the expression.

Just remember to change the 0x into &H and all will be fine.

Upvotes: 0

ulu
ulu

Reputation: 6092

Fixed it by selecting a non-Web project in Solution Explorer

Upvotes: 0

Tim Gradwell
Tim Gradwell

Reputation: 2402

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.

Upvotes: 4

Luciano
Luciano

Reputation: 2999

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

Upvotes: 2

Related Questions