From 616b56f4bd822601eeff7ffe3c638945788ec51d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Kaan=20K=C3=B6se?= Date: Sat, 1 Feb 2025 23:15:01 +0100 Subject: [PATCH] Server crash handlers. --- Wino.BackgroundTasks/Wino.BackgroundTasks.csproj | 2 +- Wino.Calendar/Wino.Calendar.csproj | 2 +- Wino.Core.UWP/Wino.Core.UWP.csproj | 6 +++--- Wino.Core/Wino.Core.csproj | 2 +- Wino.Mail/Wino.Mail.csproj | 8 ++++---- Wino.Packaging/Package.appxmanifest | 2 +- Wino.Packaging/Wino.Packaging.wapproj | 2 +- Wino.Server/App.xaml.cs | 10 ++++++++++ Wino.Services/Wino.Services.csproj | 2 +- 9 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Wino.BackgroundTasks/Wino.BackgroundTasks.csproj b/Wino.BackgroundTasks/Wino.BackgroundTasks.csproj index 07fb3d5e..67f9296c 100644 --- a/Wino.BackgroundTasks/Wino.BackgroundTasks.csproj +++ b/Wino.BackgroundTasks/Wino.BackgroundTasks.csproj @@ -87,7 +87,7 @@ - 4.67.2 + 4.66.2 6.2.14 diff --git a/Wino.Calendar/Wino.Calendar.csproj b/Wino.Calendar/Wino.Calendar.csproj index 7bd17912..772b48e0 100644 --- a/Wino.Calendar/Wino.Calendar.csproj +++ b/Wino.Calendar/Wino.Calendar.csproj @@ -328,7 +328,7 @@ 8.1.240916 - 4.67.2 + 4.66.2 6.2.14 diff --git a/Wino.Core.UWP/Wino.Core.UWP.csproj b/Wino.Core.UWP/Wino.Core.UWP.csproj index 47c98ae7..fe755e00 100644 --- a/Wino.Core.UWP/Wino.Core.UWP.csproj +++ b/Wino.Core.UWP/Wino.Core.UWP.csproj @@ -190,10 +190,10 @@ 8.4.0 - 8.4.0 + 8.3.2 - 8.4.0 + 8.3.2 8.1.240916 @@ -439,4 +439,4 @@ --> - + \ No newline at end of file diff --git a/Wino.Core/Wino.Core.csproj b/Wino.Core/Wino.Core.csproj index 801b9080..2dd2ef40 100644 --- a/Wino.Core/Wino.Core.csproj +++ b/Wino.Core/Wino.Core.csproj @@ -37,7 +37,7 @@ - + diff --git a/Wino.Mail/Wino.Mail.csproj b/Wino.Mail/Wino.Mail.csproj index 51ed2236..45a075d5 100644 --- a/Wino.Mail/Wino.Mail.csproj +++ b/Wino.Mail/Wino.Mail.csproj @@ -131,13 +131,13 @@ 8.4.0 - 8.4.0 + 8.3.2 0.1.240917-build.1755 - 8.4.0 + 8.3.2 8.1.240916 @@ -173,10 +173,10 @@ 5.0.6 - 9.0.1 + 8.0.1 - 4.67.2 + 4.66.2 2.2.12-rel-33220-00 diff --git a/Wino.Packaging/Package.appxmanifest b/Wino.Packaging/Package.appxmanifest index ef42dea8..946269db 100644 --- a/Wino.Packaging/Package.appxmanifest +++ b/Wino.Packaging/Package.appxmanifest @@ -11,7 +11,7 @@ + Version="1.9.48.0" /> diff --git a/Wino.Packaging/Wino.Packaging.wapproj b/Wino.Packaging/Wino.Packaging.wapproj index c7ee2572..bb68d360 100644 --- a/Wino.Packaging/Wino.Packaging.wapproj +++ b/Wino.Packaging/Wino.Packaging.wapproj @@ -43,7 +43,7 @@ ..\Wino.Mail\Wino.Mail.csproj False SHA256 - False + True $(USERPROFILE)\Desktop\Packages\ True x64 diff --git a/Wino.Server/App.xaml.cs b/Wino.Server/App.xaml.cs index 066e462f..08c8affe 100644 --- a/Wino.Server/App.xaml.cs +++ b/Wino.Server/App.xaml.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using System.Windows; using H.NotifyIcon; using Microsoft.Extensions.DependencyInjection; +using Serilog; using Windows.Storage; using Wino.Calendar.Services; using Wino.Core; @@ -188,6 +189,9 @@ namespace Wino.Server if (isCreatedNew) { + AppDomain.CurrentDomain.UnhandledException += ServerCrashed; + Application.Current.DispatcherUnhandledException += UIThreadCrash; + TaskScheduler.UnobservedTaskException += TaskCrashed; // Ensure proper encodings are available for MimeKit System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); @@ -237,6 +241,12 @@ namespace Wino.Server } } + private void TaskCrashed(object sender, UnobservedTaskExceptionEventArgs e) => Log.Error(e.Exception, "Task crashed."); + + private void UIThreadCrash(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) => Log.Error(e.Exception, "UI thread crashed."); + + private void ServerCrashed(object sender, UnhandledExceptionEventArgs e) => Log.Error((Exception)e.ExceptionObject, "Server crashed."); + protected override void OnExit(ExitEventArgs e) { notifyIcon?.Dispose(); diff --git a/Wino.Services/Wino.Services.csproj b/Wino.Services/Wino.Services.csproj index 332cdfc1..d00b3f2d 100644 --- a/Wino.Services/Wino.Services.csproj +++ b/Wino.Services/Wino.Services.csproj @@ -10,7 +10,7 @@ - +