2 ms·
In C#, throw also re-throws and preserves the stack trace in the exception object. What the article points out that it doesn't do is preserve the full call stac
by ufmace 12y ago
In C#, throw also re-throws and preserves the stack trace in the exception object. What the article points out that it doesn't do is preserve the full call stack and method state in the Visual Studio debugger, and that only if you explicitly turn off break on throw, leaving it in break on throwing uncaught exceptions instead.
In fact, changing state in an exception filter method that always returns false sounds terrible to me. What if you actually need to do something with that exception, or to clean up state? What if the Log method does something wrong that you need to debug? Exception filters are handy, but I hope to never see them used like that.
Now the new null propagation operator, on the other hand, get me some of that, and I hope to see it used everywhere.