异常堆栈跟踪是否可以为null? [英] Can Exception stack trace ever be null?
本文介绍了异常堆栈跟踪是否可以为null?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我发现,如果我捕获到异常e,则e.innerException可能为空。
I found out that if I am catching an Exception e, e.innerException could possibly be null.
e.StackTrace是否也可能为空
Is it also possible that e.StackTrace could also be null in any possible circumstance in a catch block?
try {
}
catch(Exception e)
{
//can e.StackTrace be null here?
}
推荐答案
是。
如果创建一个 new Exception()
且不抛出该异常,则除了 Data
和消息
将为空。
If you create a new Exception()
and don't throw it, every property except Data
and Message
will be null.
这篇关于异常堆栈跟踪是否可以为null?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文