private void TimerCallback(DateTime state)
{
if (!m_enabled)
return;
if (!m_autoReset)
{
m_enabled = false;
m_registeredCallback?.Clear();
}
try
{
Elapsed?.Invoke(this, new EventArgs<DateTime>(state));
}
catch (Exception ex)
{
try
{
EventHandler<EventArgs<Exception>> unhandledExceptions = UnhandledExceptions;
if ((object)unhandledExceptions == null)
m_log.Publish(MessageLevel.Info, "Swallowed exception", null, null, ex);
else
unhandledExceptions(this, new EventArgs<Exception>(ex));
}
catch (Exception ex2)
{
m_log.Publish(MessageLevel.Warning, MessageFlags.BugReport, "Unhandled Exception callback threw an error", ex2.ToString(), null, ex2);
}
}
}