Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,
I am running windows 7, VS 2013 and wcf server application. The server application which gives the following message when I try to step into the code (F11) in Debug.

Cannot obtain value of local or arguement 'msgData' as it is not available at this instruction pointer, possibly because it has been optimized away


However when I look at the Optimize code flag under options , "Build" is not switched on. On a different Windows 7 laptop with VS 2013 it works ok. Any idea why it is failing with this message

regards
Pat
Posted
Comments
Sergey Alexandrovich Kryukov 7-Mar-15 13:34pm    
Why debugging using Release configuration? Why having optimize turned off on optimization of this configuration?
—SA

Please see my comment to the question. It is possible that your observations are not correct.

You did not tell us that you changed the configurations, but by default you would have just two configurations, "Debug" and "Release", with optimization on for the first one and off for another one. Even though you can do a lot of debugging work in any configuration (and add any new configuration), usually it is not needed. Besides, you can always introduce some temporary dummy statement (for example, such as System.Console.Write(someVariable) going nowhere without actual console), to prevent optimized it out even when optimization is on.

—SA
 
Share this answer
 
v2
Hi Sergy,
I'm sorry but I have absolutely no idea what you are talking about !!!
Lets go back to my original statement:

I am getting the following error when I try to debug my MCF server application

Cannot obtain value of local or arguement 'msgData' as it is not available at this instruction pointer, possibly because it has been optimized away

if you know why I am getting this error message then please let me know.

regards
Pat
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 8-Mar-15 1:16am    
Pat, how was I supposed to read this post? You did not post a comment on my post, so I did not get any notification.
The way you posted it is considered as abuse, because this is not a "solution", please remove it.
If you have no idea what you are talking about, you could ask me what part is not clear.

I already saw your error message. Why would you need to repeat it? Do you think it will get more clear if it is written twice? Note that you also did not provide a code sample, so you cannot ask too much. No problem though. You did not explain all your steps to this error message, but it is apparent that local msgData was optimized out. It happens all the times.

I gave you very clear instructions: either do the debugging of the code compiled with optimization turned off, or prevent optimization for the variable in question. Even if you code was correct, optimization out would be quite possible. You can inspect other variables. But nothing prevents you from working without optimization.

If something is unclear, please comment on Solution 1.

—SA
PClarkeirl 8-Mar-15 11:09am    
Hi Sergey,
wasn't my intention to upset you with my last comments. I just honestly did not understand how your comments related to my question. If it came across as a smart assed comment then I apologise as that was not my intention. That aside I have had a solution to this issue which I will post as a solution. Thank you for you input.

regards
Pat
Sergey Alexandrovich Kryukov 26-Apr-16 10:30am    
You repeated the same mistake: added a comment addressed to me, but the way I could not possibly get a notification. I just happened to click on this page by an unrelated reason.
I honestly don't understand what you don't understand, and you did not even try to explain where you are confused. How can anyone help you if you don't collaborate?
—SA
I have found a solution to this problem which is quite simple:

Possible solutions: (assume that your app has debug as active configuration build)
1. Clean-up and rebuild the solution.
2. Verify & set Debug Info mode to “full” under “Advanced Build Settings”:

•Right click the Project
•Select option “Properties”
•Go to Build -> Advanced -> Debug Info ... set to "full".


The Clean-up and re-building of the solution seems to have fixed the issue and I am now able to drop into the server code using F11 in debug mode.

regards
Pat
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900