Wednesday, January 10, 2018

VS project "Optimized Code" :: Cannot obtain value of local or argument as it is not available at this instruction pointer

While debugging an existing code in VS 2015 tried to "watch" a couple of variables and encountered with below message without showing the values:
"Cannot obtain value of local or argument as it is not available at this instruction pointer, possibly because it has been optimized away"

To fix it and get rid of optimization to be able to see the values and also keep debugging in steps without jumping between lines because of optimized code then I unchecked the [Optimize Code]:

Project Properties --> under Build --> Unchecked the [Optimize Code] checkbox.
In the Advanced Options in the project build tab, I set the the "Debug Info" combo to "Full".

Share/Bookmark

No comments: