对象未设置异常查询 [英] Object Not Set Exception Query

查看:63
本文介绍了对象未设置异常查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个关于对象未设置/空例外的查询。

现在,我有一个奇怪的情况在我的开发环境中,一段代码没有问题。但是,当系统有时(不经常)在客户站点上线时,我会得到一个没有设置异常的对象。



现在我的问题是,在实时环境如何识别哪个对象是null / nothing?我无法在错误消息中发现任何告诉我抛出它的对象的名称,只有抛出它的方法?



谢谢

Hi Guys,

I have a query regarding Object Not Set / Null Exceptions.
Now, I have a bizare situation where in my development environment a section of code is working with no issues. However, when the system goes live on a customer site sometimes (not often) I am getting an object not set exception throw up.

Now my question is, on a live environment how can I identify which object it is that is null/nothing? I cannot spot anything in the error message that tells me the name of the object that is throwing it, only the method that throws it?

Thanks

推荐答案

系统生成的错误消息框将允许您查看详细信息和StackTrace,它可以告诉您哪个方法是错误的位置和实际的行号。使用该信息,修改程序以在所有代码中添加Try ... Catch块,这些代码在经历异常的方法中设置对象。在每个Catch块中显示一个MessageBox或向EventLog写入一些有关错误消息和程序中位置的信息。
The system generated error message box will allow you to "View Details" and the StackTrace which can tell you which of your methods is the location of the error and the actual line number. Using that information, modify your program to add Try...Catch blocks around all of your code that is setting objects in the method that experienced the exception. In each Catch block display a MessageBox or write to the EventLog some information about the error message and the location in your program.


这篇关于对象未设置异常查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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