• 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 51 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 59 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
0 votes
1 answer 204 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 21 views
Problem: I am currently working on developing the add in for the outlook 2010 with a Visual Studio Ultimate 2013. To create a setup package I am trying to use the InstallShield limited Edition. The setup has generated works on the 64 bit pc. It is not working ... 2010 Runtime The Visual studio 2010 Tools for the Office runtime I manually tried to remove any of the register on the 64 bit position.
asked Jul 6, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 82 views
Problem : I am facing this Kind of Error like:: Specified argument was out of the range of valid values.Parameter name: site While Debugging any of the Project. I have also tried after Reinstalling the Visual ... +9873912 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
asked Jan 20, 2020 jwilliam 3.9k points
0 votes
1 answer 76 views
Problem: I am naïve to C# programming. I am trying to use the auto-implemented properties. I think the best ever way to fix below error is to declare my own backing variable? Please find below my C# code: public Point Origin { get; set; } ... unchanged. To resolve this error, store the result of the expression in an intermediate value, or use a reference type for the intermediate expression.
asked Jul 23, 2020 Raphael Pacheco 4.9k points
1 vote
1 answer 41 views
Problem : I want to create the simple user control that should be the slider. When I try to add the AjaxToolkit SliderExtender to my user control I usually get below error: Server Error in '/' Application. The Controls collection cannot be modified because ... control and also tried adding the textbox and the slider extender to my placeholder programmatically but I am still facing the above error.
asked Dec 14, 2019 alecxe 7.5k points