Visual Studio调试器显示错误的值(在应有值的地方为null) [英] Visual Studio debugger shows wrong value (null where there should be a value)

查看:72
本文介绍了Visual Studio调试器显示错误的值(在应有值的地方为null)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被困住了,为什么会这样?代码从字面上说是实体!= null,但调试器认为它为null.发生了什么事?

I'm stuck, why does this happen? The code literally says that entity != null but the debugger thinks it's null. What is going on?

我已经更改为x86,重新编译,清理,甚至重新启动了PC.而且代码始终是这样的,没有版本的if语句是不同的.而且,如果我继续,我不会得到空指针异常.

I already changed to x86, recompiled, cleaned, even restarted the pc. And the code was always like this, there is no version where the if statement was different. And if I continue I don't get a null-pointer exception.

推荐答案

当在方法中早期声明了具有相同名称的变量时,我遇到了相同的问题.在那种情况下,调试器只会注意"第一个变量.它对实际代码执行没有影响.

I experienced the same problem when there was variable with same name declared earlier in the method. In that case debugger would only 'notice' first variable. It has no impact on actual code execution.

这篇关于Visual Studio调试器显示错误的值(在应有值的地方为null)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆