I want to do something mildly silly. In my Dispose()
method for an object, I want to print a debug trace for the object, telling me all events which happened while it was alive.
But as this takes time and money, I only want to do this if Dispose()
is being called because an exception was thrown.
So I would like to do
if (exceptionIsCurrentlyRaised) PrintDebugStuff();
Does .NET have such a exceptionIsCurrentlyRaised property which I can query?