Can Exception stack trace ever be null?

c#, exception

Solution

Yes.

If you create a `new Exception()` and don't throw it, every property except `Data` and `Message` will be null.

Problem

I found out that if I am catching an Exception e, e.innerException could possibly be null. 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? } ```

Original source

Related problems