public void Dispose()
{
if (TracerConfig.Instance.IsEnabled(this.myType, MessageTypes.Exception, this.myLevel))
{
// only print exception warning when we did not have an exception on the thread stack
// when we did enter this method. Otherwise we would print a warning while we entered and left a method while
// executing a catch handler altough in our called methods nothing has happened.
var currentException = ExceptionHelper.CurrentException;
if (currentException != null && ReferenceEquals(myLastPrintedException, currentException) == false)
{
myLastPrintedException = currentException;
TraceMsg(MsgTypeException, this.TypeMethodName, DateTime.Now, "Exception thrown: {0}", currentException);
}
}
if (TracerConfig.Instance.IsEnabled(this.myType, MessageTypes.InOut, this.myLevel))
{
var now = DateTime.Now;
TraceMsg(MsgTypeOut, this.TypeMethodName, now, "Duration {0}", this.FormatDuration(now.Ticks - this.myEnterTime.Ticks));
}
}