From 293235222027379350d34edd23feaca1a6dcc417 Mon Sep 17 00:00:00 2001 From: doyaGu Date: Sat, 3 Oct 2026 22:49:48 -0400 Subject: [PATCH] fix(dialogs): keep a failing cancel in the title-bar close handler from ending the app OnClosing is async void, so an exception from the view model's cancel path was unobserved and crashed the process. It is now logged and the dialog stays open. --- YKanBan/Views/Dialogs/DialogWindow.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/YKanBan/Views/Dialogs/DialogWindow.cs b/YKanBan/Views/Dialogs/DialogWindow.cs index ef19c18..e4dc799 100644 --- a/YKanBan/Views/Dialogs/DialogWindow.cs +++ b/YKanBan/Views/Dialogs/DialogWindow.cs @@ -1,3 +1,4 @@ +using System.Diagnostics; using Avalonia.Controls; using Avalonia.Threading; using Avalonia.VisualTree; @@ -85,6 +86,12 @@ public class DialogWindow : Window { await _viewModel.RequestCancelAsync(); } + catch (Exception exception) + { + // An async void handler must not let a failure escape and end the + // process; the dialog simply stays open. + Debug.WriteLine(exception); + } finally { _cancelPending = false;