异常堆栈跟踪是否可以为空?

Hen*_*hiu 12 c# exception

我发现如果我捕获异常e,e.innerException可能为null.

在catch块的任何可能情况下,e.StackTrace也可能为null吗?

try {

}
catch(Exception e)
{
//can e.StackTrace be null here?
}
Run Code Online (Sandbox Code Playgroud)

SLa*_*aks 16

是.

如果你创建一个new Exception()并且不抛出它,除了Data和之外的每个属性都Message将为null.