From 3cadb9a179b6b9a7a43ba592144192ac9073bb65 Mon Sep 17 00:00:00 2001 From: Nabile Rahmani Date: Tue, 11 Dec 2018 21:19:13 +0100 Subject: [PATCH] Updater: Complete Windows update even in case of unhandled exceptions. --- DotN64.Desktop/Updater.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/DotN64.Desktop/Updater.cs b/DotN64.Desktop/Updater.cs index 2da7838..8ab2983 100644 --- a/DotN64.Desktop/Updater.cs +++ b/DotN64.Desktop/Updater.cs @@ -150,12 +150,15 @@ namespace DotN64.Desktop scriptFile.Attributes |= FileAttributes.Hidden; - AppDomain.CurrentDomain.ProcessExit += (s, e) => Process.Start(new ProcessStartInfo(scriptFile.FullName) + void RunScript() => Process.Start(new ProcessStartInfo(scriptFile.FullName) { UseShellExecute = false, CreateNoWindow = true, WorkingDirectory = InstallDirectory }); + + AppDomain.CurrentDomain.ProcessExit += (s, e) => RunScript(); + AppDomain.CurrentDomain.UnhandledException += (s, e) => RunScript(); } #endregion }