为什么我的 VS2008 手表显示的值不正确?
我有一个字符串变量和一个字符串常量。两者应该是相同的值(我正在测试条件中的相等性)。两者的“正确”值应该是“scl”。在调试时,如果我在每个上放一个手表,在“本地”窗口中查看它们,或将鼠标悬停在它们上,则显示的值是“sd”,这是类中不同常量的值(还有许多其他常量)类中正确显示值的常量和变量)。如果我为有问题的变量/常量值插入 Debug.WriteLine(在与手表相同的范围内),输出窗口将打印每个值的正确值。对于我的一生,我无法弄清楚为什么会发生这种情况,或者如何纠正它。
I have a string variable and a string constant. Both should be the same value (I'm testing for equality in a conditional). The 'correct' values of both should be "scl". While debugging, if I put a watch on each, look at them in the 'locals' windows, or hover over them, the value displayed is "sd", which is the value of a different constant in the class (there are many other constants and variables in the class that are displaying values correctly). If I insert a Debug.WriteLine for the variable/constant value in question, (in the same scope as the watch) the output window prints the correct value of each. For the life of me, I can't figure out why this is happening, or how to correct it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我似乎通过更改常量的值,运行调试会话,然后将值更改回应有的值来修复它。也许这清除了某种调试缓存。
感谢大家的帮助!
I seemed to have fixed it by changing the value of the constant, running a debugging session, then changing the value back to what it should be. Perhaps this cleared out some kind of debugging cache.
Thanks for the help all!
它是一个延迟加载的属性吗?我过去遇到过这样的问题,我做过这样的事情(这是一个非常人为的例子,但它会做)
Is it a lazy loaded property? I've had issues like this in the past where I've done something like this (horribly contrived example, but it will do)