• Register
0 votes

Problem :

I am using the Visual Studio 2010 in a debug mode and I have "optimize code" unchecked. I am unable to quick watch (or hover on) any variable in my debugger. I encountered following error "Cannot evaluate expression because the code of the current method is optimized".

Even the line like: int i = -3, doing the quick watch on i, I encountered following error "Cannot obtain value of local or argument 'i' as it is not available at this instruction pointer, possibly because it has been optimized away."

Am I missing any setting here ?

7 5 2
3,870 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

While my project was in the debug mode, my solution was not. So when I changed it, everything worked for me.


I had this same issue when I was using the VS 2010. My solution configuration has a (Debug) selected. I resolved this by simply unchecking a Optimize Code property under a project properties. Follow it  Project (right Click)=> Properties => Build (tab) => uncheck Optimize code


In the VS2013 go to: Tools -> Options -> Debugging -> General and enable the 'Use managed compatibility mode'. This disables your new function evaluation behavior.

Hope above solutions help you in resolving your issue.

9 7 4
38,600 points

Related questions

1 vote
1 answer 3 views
Problem: Why I got the error : The name 'InitializeComponent' does not exist in the current context. I create a new project in Visual Studio 2010 SP1 and select "WPF Application" .When I tries to build the generated its show Error.
asked Mar 20 Shovo210 13.2k points
0 votes
0 answers 8 views
Problem: Hi, any idea that what should I do to fix it…I am new in php kb2468871v2 does not apply, or is blocked by another condition on your computer.
asked Mar 24 Ifra 24.4k points
1 vote
1 answer 70 views
Problem : I am unable to build my projects as I am facing below message: “Unable to find manifest signing certificate in the certificate store”. I have tried to run my Visual Studio as the Administrator and also I have tried to manually add my keys to ... Project Properties but above error is still appearing. I am unable to fix above error. Can someone guide me in fixing above error?
asked Apr 4, 2020 morrisBson 3.2k points
0 votes
1 answer 1 view
1 view
Problem: Does anyone know the solution of it? So kindly let me know .. How to test code in visual studio?
asked 3 days ago Ifra 24.4k points
0 votes
1 answer 5 views
Problem: Can anyone tell me the solution of this problem? What language does visual studio use?
asked Mar 25 Ifra 24.4k points
0 votes
1 answer 82 views
Problem : I have recently installed the Visual Studio 2012 Release Preview, and it works fine, however now when I want to use Visual Studio 2010 to compile my C++ projects, I am facing below error message: LINK : fatal error LNK1123: failure during conversion to ... tried to uninstall my Visual Studio 2012 and rebooted my box but the problem still persists!. Does anyone has any solution on it.
asked Dec 6, 2019 alecxe 7.5k points
1 vote
1 answer 5 views
Problem : I have tried setting server to localhost, user to root but I get the following error : Error: 0 : Unable to connect to any of the specified MySQL hosts. Can someone please help fix this ?
asked Mar 21 Shovo210 13.2k points
0 votes
1 answer 254 views
Problem : I am troubled by following error skipped loading symbols. module is optimized and the debugger option 'just my code' is enabled.
asked Nov 13, 2019 peterlaw 6.9k points
0 votes
1 answer 7 views
Problem : Getting “Handshake failed…unexpected packet format” when using WebClient.UploadFile() with “https” when the server has a valid SSL certificate. Any ideas on what I need to do to fix this? Thanks!
asked Mar 20 Shovo210 13.2k points