private void OnContextShuttingDown(IntPtr pContext, IntPtr pCookie)
{
// context is shutting down. This object is no longer valid
// no need to unregister from event, the event is destroyed anyway
UnsafeReplaceInternalObject(IntPtr.Zero);
Dispose();
}