diff --git a/src/DynamoRevit/DynamoRevit.cs b/src/DynamoRevit/DynamoRevit.cs index 9e1431c91b..4ae40c3182 100644 --- a/src/DynamoRevit/DynamoRevit.cs +++ b/src/DynamoRevit/DynamoRevit.cs @@ -696,7 +696,6 @@ private static DynamoView InitializeCoreView(DynamoRevitCommandData commandData) DynamoAppExternalEvent = ExternalEvent.Create(appEventHandler); - dynamoView.Dispatcher.UnhandledException += Dispatcher_UnhandledException; dynamoView.Closed += OnDynamoViewClosed; dynamoView.Loaded += (o, e) => DynamoAppExternalEvent.Raise(); @@ -1019,52 +1018,6 @@ public static string GetRevitContext(DynamoRevitCommandData commandData) #endregion - #region Exception - - /// - /// A method to deal with unhandled exceptions. Executes right before Revit crashes. - /// Dynamo is still valid at this time, but further work may cause corruption. Here, - /// we run the ExitCommand, allowing the user to save all of their work. - /// - /// - /// Info about the exception - private static void Dispatcher_UnhandledException( - object sender, DispatcherUnhandledExceptionEventArgs args) - { - args.Handled = true; - - // only handle a single crash per Dynamo sesh, this should be reset in the initial command - if (handledCrash) - return; - - handledCrash = true; - - string exceptionMessage = args.Exception.Message; - - try - { - Dynamo.Logging.Analytics.TrackException(args.Exception, true); - - RevitDynamoModel.Logger.LogError("Dynamo Unhandled Exception"); - RevitDynamoModel.Logger.LogError(exceptionMessage); - } - catch { } - - try - { - DynamoModel.IsCrashing = true; - RevitDynamoModel.OnRequestsCrashPrompt(new CrashErrorReportArgs(args.Exception)); - RevitDynamoViewModel.Exit(false); // don't allow cancellation - } - catch { } - finally - { - args.Handled = true; - DynamoRevitApp.DynamoButtonEnabled = true; - } - } - - #endregion #region Shutdown @@ -1077,7 +1030,6 @@ private static void OnDynamoViewClosed(object sender, EventArgs e) { var view = (DynamoView)sender; - view.Dispatcher.UnhandledException -= Dispatcher_UnhandledException; view.Closed -= OnDynamoViewClosed; DynamoRevitApp.DynamoButtonEnabled = true; @@ -1095,7 +1047,6 @@ private static void OnSplashScreenClosed(object sender, EventArgs e) { var view = (Window)sender; - view.Dispatcher.UnhandledException -= Dispatcher_UnhandledException; view.Closed -= OnSplashScreenClosed; //if the user explicitly closed the splashscreen, then we should let them boot //dynamo back up.