Error Cannot Obtain Value Visual Studio
Contents |
Visual Studio Diagnostics (Debugger, Profiler, IntelliTrace) Question 0 Sign in to vote hello I have a problem while debugging in cannot obtain value of local or argument optimized away visual studio 2005 i have a class with an enumerator member in
Visual Studio 2015 Cannot Obtain Value
it, and while debugging when i want to see the value of the enumerator I get the
Complus_zapdisable=1
error "error: cannot obtain value" is there any way to see the enumerator value? Thursday, February 22, 2007 9:53 AM Reply | Quote Answers 0 Sign in to vote
The Value Of The Local Or Argument Is Unobtainable At This Time
I believe this to be a bug in the managed C++ expression evaluator.A workaround would be to enter the full expression for the sub item into the watch window, like so:MyTest.mBool Marked as answer by rchiodo - MSFTModerator Friday, November 13, 2009 11:45 PM Friday, November 13, 2009 11:45 PM Reply | Quote Moderator All replies 0 Sign in cannot obtain value of the local variable or argument because it is not available to vote I am seeing the same problem using Visual C++ 2008 with the following versions: Microsoft Visual Studio 2008 Version 9.0.21022.8 RTM Microsoft .NET Framework Version 3.5 SP1 The problem is easily reproducible by creating an empty CLR project, and creating a CPP file with the following code: enum UnmanagedBool { Bool_False, Bool_True }; struct UnmanagedStruct { UnmanagedStruct() : mBool( UnmanagedBool::Bool_False ) { } UnmanagedBool mBool; }; int main() { UnmanagedStruct MyTest; return 0; } If you set a breakpoint on the last line of the main function, you'll see that the debugger shows "error: cannot obtain value" for the value of mBool. Interestingly, if you right click on mBool and select 'Add Watch' you'll be able to see the value for it. When you then go back to viewing the local variable MyTest, it will show a green refresh symbol next to the value of mBool. Clicking this will then show the correct value. Changing UnmanagedStruct to a managed struct by adding the ref keyword allows you to see the numerical value fo
Osenkov - MSFTJanuary 27, 20093 0 0 0 Sooner or later you may run into a situation where you need to evaluate a local variable under debugger and all you get is this: "Cannot cannot evaluate the expression because the code of the current method is optimized obtain value of local or argument ‘whatever' as it is not available visual studio disable optimization at this instruction pointer, possibly because it has been optimized away'. Well, it turns out there are two different disable visual studio hosting process tricks to solve such problems: 1. Shawn Burke blogs about How to disable optimizations when debugging Reference Source. In a nutshell, you need to: Start VS with the Environment Variable https://social.msdn.microsoft.com/Forums/vstudio/en-US/558ee4d5-3f16-4dff-a231-e6f8301df7a2/cannot-obtain-value-error-message?forum=vsdebug COMPLUS_ZapDisable=1 Disable the VS Hosting Process (.vshost.exe) before you start debugging 2. Another tip is from our VB IDE Dev Jared Parsons: Disabling JIT optimizations while debugging. Essentially, Jared points to create an .ini file with the same name as the application's .exe: [.NET Framework Debugging Control] GenerateTrackingInfo=1 AllowOptimize=0 He also points to the MSDN article http://msdn.microsoft.com/en-us/library/9dd8z24x.aspx (Making an Image Easier to https://blogs.msdn.microsoft.com/kirillosenkov/2009/01/27/how-to-disable-optimizations-during-debugging/ Debug). To be frank, this tip didn't work for me for some reason, but I guess it's still worth mentioning. Hope this helps! Tags KnowledgeBase Comments (3) Cancel reply Name * Email * Website Mike says: February 23, 2011 at 12:37 pm The second suggestion worked for me. I was debugging a WCF service hosted as a windows service. Attaching to the process was causing the same error. I uninstalled the service in question. Created a new {myProjectName}.ini with the text editor of your choice with the above section and settings in the same folder as the exe which was installed. From there attaching to the process and breaking in no longer throws the "Cannot obtain value…" error. Reply Ethan Woo says: January 31, 2013 at 12:21 am Attaching to the process always shows the error for IIS hosting WebApp, after i debug with F5 for the Hosted WebApp, local variable can be evaluated. Reply Ab says: December 22, 2014 at 8:50 pm Second one worked for me. Thank you. Reply Follow UsPopular TagsCoding DevCenter VS 2010 Links KnowledgeBase LiveGeometry C# 4.0 Algorithm Si
obtain value' on any variable (DataSet in my case) even when the information is passed correctly from the DataTier into the DataSet. What was interesting about this error is that it never happened to any other DataSet in http://www.zubairahmed.net/?p=85 the same class. After googling for the problem, I found out that following the insertion http://cboard.cprogramming.com/csharp-programming/104917-can-not-obtain-local-variable-value-visual-studio-2008-a.html to the DataSet, my class had a call to a function with apparently more parameters than VS Debugger can handle and therefore the error. This looks like an issue with the Debugger that requires attention of our friends at MS. « Too many things, Too little time Cache Access Pattern and updating it frequently » Software Developer. Blogger. Speaker cannot obtain Subscribe to RSS feed Follow @zubairdotnet Zubair Ahmed on Twitter Counter Search for: Archives Select Month March 2015 (1) November 2014 (1) June 2014 (1) January 2014 (1) December 2013 (2) September 2013 (3) July 2013 (3) May 2013 (1) April 2013 (1) January 2013 (1) November 2012 (1) September 2012 (2) August 2012 (1) July 2012 (1) June 2012 (1) May 2012 (1) April 2012 (3) March 2012 (3) October 2011 (1) cannot obtain value September 2011 (1) July 2011 (1) June 2011 (1) May 2011 (1) April 2011 (1) February 2011 (1) September 2010 (2) July 2010 (4) June 2010 (1) May 2010 (1) January 2010 (1) November 2009 (2) October 2009 (2) August 2009 (2) July 2009 (1) May 2009 (2) April 2009 (2) December 2008 (1) November 2008 (2) June 2008 (4) May 2008 (2) April 2008 (4) February 2008 (1) January 2008 (1) December 2007 (2) November 2007 (3) October 2007 (1) July 2007 (3) June 2007 (2) May 2007 (3) April 2007 (4) March 2007 (2) September 2006 (1) August 2006 (2) July 2006 (3) June 2006 (1) May 2006 (3) April 2006 (2) March 2006 (3) February 2006 (1) January 2006 (2) December 2005 (3) November 2005 (4) October 2005 (3) September 2005 (7) August 2005 (5) July 2005 (1) June 2005 (9) May 2005 (13) April 2005 (1) January 2005 (2) Categories Select Category .ne(1) .NET 2.0(1) .NET 3.5(4) .NET 4.0(6) .NET 4.5(15) .NET Framework(11) .NET Micro Framework(1) ADO.NET(1) Agent SmartWatch(1) Agile(1) AOP(1) AppFabric(2) Architecture(2) ASP.NET(13) ASP.NET 4.5(2) ASP.NET AJAX(2) ASP.NET Charts(1) asp.NETPro(1) Async(2) automation(1) batches(1) Bing Map(1) BlackBerry(1) C#(13) Cache(1) Caching(2) Cloud(1) Cloud Computing(2) Code quality(1) CodeSmith Studio(1) CustomValidator(1) Data Services(1) DataTable(1) Domain Driven Design(1) DTN(1) Dubai(1) ELMAH(1) Entity Framework(2) Exceptions(1) Extensibility(1) Extension methods(2) Facebook(1) github(1) Google(2) Info
Programming Boards C# Programming can not obtain local variable value in Visual Studio 2008 Getting started with C or C++ | C Tutorial | C++ Tutorial | C and C++ FAQ | Get a compiler | Fixes for common problems Thread: can not obtain local variable value in Visual Studio 2008 Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 07-08-2008 #1 George2 View Profile View Forum Posts Registered User Join Date May 2006 Posts 1,579 can not obtain local variable value in Visual Studio 2008 Hello everyone, When remote debugging a release version binary on a remote machine using Visual Studio 2008, there is error message from local host machine in Visual Studio when I try to see some local variable values. The error message is (1st message is displayed when my mouse stops at the variable in Locals, the 2nd message is what is displayed when I pressed refresh button for the specific local variable), -------------------- The value for this item is stale dues to a problem that occured while evaluating it. Hover your cursor over the refresh button for details. newNumbers Cannot obtain value of local or argument 'newNumbers' as it is not available at this instruction pointer, possibly because it has been optimized away. int -------------------- Such issue only happens with release version, debug version is fine. Any ideas how to solve this? I need to debug release version. thanks in advance, George 07-08-2008 #2 nvoigt View Profile View Forum Posts the hat of redundancy hat Join Date Aug 2001 Location Hannover, Germany Posts 3,130 ...possibly because it has been optimized away. I'd say your variable has been optimized away. Is there a reason why you need to debug a release version on a remote machine ? Use your variable to do something worthwhile that cannot be optimized away (write to file, or use it as input somewhere). If a variable that is crucial to your programs success has been optimized away, maybe your program has some logical pro