/// <summary> /// Sets an unhandled exception configuration /// (<seealso cref="IUnhandledExceptionConfiguration"/>) /// </summary> /// <param name="unhandledExceptionConfiguration"> /// Callbacks configuration to execute when native and/or managed exception occurred</param> public void SetUnhandledExceptionConfiguration( IUnhandledExceptionConfiguration unhandledExceptionConfiguration) { lock (SYNC_ROOT) { try { LOG.InfoFormat("Setting unhandled exception configuration"); DnsExceptionHandler.Init(unhandledExceptionConfiguration); DnsExceptionHandler.SetUnhandledExceptionConfiguration(); LOG.InfoFormat("Setting unhandled exception configuration has been successfully completed"); } catch (Exception ex) { LOG.ErrorFormat("Setting unhandled exception configuration failed with an error", ex); } } }
/// <summary> /// Initializes the <see cref="DnsExceptionHandler"/> with /// the specified <see cref="unhandledExceptionConfiguration"/> /// </summary> /// <param name="unhandledExceptionConfiguration">Callbacks /// for handling the managed and native unhandled exceptions /// (<seealso cref="IUnhandledExceptionConfiguration"/>)</param> internal static void Init(IUnhandledExceptionConfiguration unhandledExceptionConfiguration) { lock (SYNC_ROOT) { m_UnhandledExceptionConfiguration = unhandledExceptionConfiguration; if (unhandledExceptionConfiguration == null) { return; } UnhandledExceptionCallbackAdapter unhandledExceptionCallbackAdapter = new UnhandledExceptionCallbackAdapter(m_UnhandledExceptionConfiguration); m_UnhandledNativeExceptionFilterCallback = unhandledExceptionCallbackAdapter.OnUnhandledNativeExceptionFilter; m_UnhandledManagedExceptionCallback = unhandledExceptionCallbackAdapter.OnUnhandledManagedException; } }
/// <summary> /// Creates an instance of the adapter /// </summary> /// <param name="unhandledExceptionConfiguration">Unhandled exception callbacks configuration, /// which implements /// the <see cref="IUnhandledExceptionConfiguration"/> interface</param> internal UnhandledExceptionCallbackAdapter( IUnhandledExceptionConfiguration unhandledExceptionConfiguration) { m_UnhandledExceptionConfiguration = unhandledExceptionConfiguration; m_OnUnhandledNativeExceptionFilter = OnUnhandledExceptionFilter; }