public void OnShutdown()
{
ConnectionShutdownEventHandler handler;
ShutdownEventArgs reason;
lock (m_eventLock)
{
handler = m_connectionShutdown;
reason = m_closeReason;
m_connectionShutdown = null;
}
if (handler != null)
{
foreach (ConnectionShutdownEventHandler h in handler.GetInvocationList()) {
try {
h(this, reason);
} catch (Exception e) {
CallbackExceptionEventArgs args = new CallbackExceptionEventArgs(e);
args.Detail["context"] = "OnShutdown";
OnCallbackException(args);
}
}
}
AppDomain.CurrentDomain.DomainUnload -= HandleDomainUnload;
}