private void OnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { if (_mainWindow != null) { _mainWindow.ApplicationExit(null, null); // KBR TODO hack: force configuration save on exception } }