Visual Studio Debugger not showing variable details on mouseover because it is "out of context"

13,454

Go to the properties of the project and uncheck "Optimize code". Rebuild your code. If the problem persists, restart Visual Studio.

Share:
13,454

Related videos on Youtube

user3685285
Author by

user3685285

Updated on July 13, 2022

Comments

  • user3685285
    user3685285 almost 2 years

    I have an F# program in Visual Studio 2013 that creates an object at the very beginning. I want to debug the code and look at the value of this object at many different points in time. I was previously able to do this by mousing over the variable in debug mode, but for some reason, I'm no longer able to do that. When I add a watch, it gives me the error:

    The value for this item is stale due to a problem that occurred while evaluating it. Hover your cursor over the refresh button for details. Old Value: The name 'MyData' does not exist in the current context.

    Then hovering over the refresh button:

    The value of this expression may be incorrect. It could not be evaluated because: 'The name 'MyData' does not exist in the current context' Click this button to attempt reevaluation now.

    What is even stranger is that I know the variable works because it gets passed as a parameter to other external functions, and I can see all the values in those secondary functions, but not in the global scope! Does anyone know what is going on?