private void ReportFatalError(Exception exception) { _log.Error("Unhandled exception", exception); if (_host != null) { _log.Debug("Reporting fatal error to host"); _host.ReportFatalError(ExceptionUtil.GetUserMessage(exception), exception.ToString()); } else { _log.Warn("Host is null, cannot report error to host"); } _log.Info("Exiting the process to prevent 'program stopped working' dialog"); _log.Dispose(); // flush pending data Environment.Exit(2); }