为什么不反对在.NET中引用错误的异常告诉我,哪个对象是空? [英] Why don't object reference error exceptions in .net tell me which object was null?

查看:106
本文介绍了为什么不反对在.NET中引用错误的异常告诉我,哪个对象是空?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许问这个问题暴露出我缺乏了解的过程中,但话又说回来,有没有更好的理由要求!

Maybe asking the question betrays my lack of knowledge about the process, but then again, there's no better reason to ask!

跟踪这些下降可能是令人沮丧,因为堆栈跟踪可以帮助我知道从哪里开始寻找,但没有哪个对象为null。

Tracking these down can be frustrating because stack traces can help me know where to start looking but not which object was null.

这是怎么引擎盖下怎么回事?难道是因为变量名不​​是可执行文件捆绑?

What is going on under the hood here? Is it because the variable names aren't bundled in the executable?

推荐答案

.NET code建有完整的优化和没有调试信息:您的局部变量名都消失了,有些局部变量可能已被完全消除

.NET code built with full optimizations and no debug info: your local variable names are gone, some local variables may have been eliminated entirely.

.NET code建有完整的优化+ PDB(或全调试):大多数局部变量名preserved,一些本地变量可能会被取消

.NET code built with full optimizations + PDB (or full debug): most local variable names preserved, some local variables may have been eliminated

没有优化+没有调试信息:局部变量名都没有了。

No optimizations + no debug info: local variable names are gone.

然后,我们必须考虑到,无论你正在处理的可能不是一个局部变量 - 它可能是一个previous函数调用的结果,在其上你链接一个新功能调用。

And then we have to consider that whatever you're dealing with may not be in a local variable at all - it might have been the result of a previous function call, on which you're chaining a new function call.

这篇关于为什么不反对在.NET中引用错误的异常告诉我,哪个对象是空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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