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.
This commit is contained in:
doyaGu committed 2026-10-03 22:49:48 -04:00
1 parent a7b07db034
commit 2932352220
1 file changed
+7
+7
View File
@@ -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;