From c186d3400f85ec3db923e2d6dd615937532ab033 Mon Sep 17 00:00:00 2001
From: Paul Woolcock <11843015+phw198@users.noreply.github.com>
Date: Sat, 25 Sep 2021 21:34:13 +0100
Subject: [PATCH] Report error before application closes. #1295
---
src/OutlookGoogleCalendarSync/Forms/MainForm.Designer.cs | 2 +-
src/OutlookGoogleCalendarSync/OutlookGoogleCalendarSync.csproj | 2 +-
src/OutlookGoogleCalendarSync/Program.cs | 3 ++-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/OutlookGoogleCalendarSync/Forms/MainForm.Designer.cs b/src/OutlookGoogleCalendarSync/Forms/MainForm.Designer.cs
index 010dafd3..962b238b 100644
--- a/src/OutlookGoogleCalendarSync/Forms/MainForm.Designer.cs
+++ b/src/OutlookGoogleCalendarSync/Forms/MainForm.Designer.cs
@@ -12,7 +12,7 @@ partial class Main {
protected override void Dispose(bool disposing) {
System.Boolean notificationTrayExited = false;
try {
- notificationTrayExited = Forms.Main.Instance.NotificationTray.Exited;
+ notificationTrayExited = Forms.Main.Instance.NotificationTray?.Exited ?? true;
} catch {
notificationTrayExited = true;
}
diff --git a/src/OutlookGoogleCalendarSync/OutlookGoogleCalendarSync.csproj b/src/OutlookGoogleCalendarSync/OutlookGoogleCalendarSync.csproj
index a3ff914a..330f00d8 100644
--- a/src/OutlookGoogleCalendarSync/OutlookGoogleCalendarSync.csproj
+++ b/src/OutlookGoogleCalendarSync/OutlookGoogleCalendarSync.csproj
@@ -103,7 +103,7 @@
ManagedMinimumRules.ruleset
- bin\Release-clean\
+ bin\Release\
TRACE
true
4096
diff --git a/src/OutlookGoogleCalendarSync/Program.cs b/src/OutlookGoogleCalendarSync/Program.cs
index 07ec610c..473eb219 100644
--- a/src/OutlookGoogleCalendarSync/Program.cs
+++ b/src/OutlookGoogleCalendarSync/Program.cs
@@ -84,6 +84,7 @@ private static void Main(string[] args) {
} catch (System.Runtime.InteropServices.COMException ex) {
OGCSexception.Analyse(ex);
+ MessageBox.Show(ex.Message, "Application terminated!", MessageBoxButtons.OK, MessageBoxIcon.Error);
throw new ApplicationException("Suggest startup delay");
}
@@ -96,7 +97,7 @@ private static void Main(string[] args) {
"Set a delay on startup", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
} else if (!string.IsNullOrEmpty(aex.Message))
- MessageBox.Show(aex.Message, "Application terminated", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ MessageBox.Show(aex.Message, "Application terminated!", MessageBoxButtons.OK, MessageBoxIcon.Error);
log.Warn("OGCS has crashed out.");
} catch (System.Exception ex) {