3 ms·
The stack trace is generated at the moment the exception is created. Unnecessarily catching exceptions you don't intend to deal with is a habit that is much mo
by bunderbunder 15y ago
The stack trace is generated at the moment the exception is created.
Unnecessarily catching exceptions you don't intend to deal with is a habit that is much more dangerous to stack traces, because it's easy to miss the huge semantic distinction between
// leaves the Exception's stack trace intact.
catch (Exception ex) { throw; }
and
// Replaces the Exception's stack trace
// with a trace to the current execution point.
catch (Exception ex) { throw ex; }