Variable does not exist in the current context while debugging

前端 未结 5 1175
春和景丽
春和景丽 2020-12-29 21:58

I inserted two temp variables and want to see their values, but I can\'t. I could solve it by placing it somewhere else, but I\'m interested why this behaviour exists.

5条回答
  •  长情又很酷
    2020-12-29 22:44

    I've encountered another scenario in VS2012 that causes variables to "disappear" while in debug mode:

    make sure you don't have this:

    if(false)
       {
       .
       }
    else
       {
       //Code here will be optimized and variables will not be available.
       }
    

提交回复
热议问题