From 9d3a06bf7af536c56df843987542d7a4a882106a Mon Sep 17 00:00:00 2001 From: SuperDooper <37051355+superdooper86@users.noreply.github.com> Date: Mon, 11 May 2026 21:20:04 +0200 Subject: [PATCH] Diagnostics: retry clipboard on COMException to fix crash --- windows/PopupWindow.xaml.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/windows/PopupWindow.xaml.cs b/windows/PopupWindow.xaml.cs index 4563b47..45054b6 100644 --- a/windows/PopupWindow.xaml.cs +++ b/windows/PopupWindow.xaml.cs @@ -495,7 +495,12 @@ public partial class PopupWindow : Window private void CopyDiag_Click(object s, RoutedEventArgs e) { - Clipboard.SetText(BuildDiagText()); + var diagText = BuildDiagText(); + for (int i = 0; i < 5; i++) + { + try { Clipboard.SetText(diagText); break; } + catch (Exception) { System.Threading.Thread.Sleep(100); } + } CopyDiagButton.Content = "Copied! (IDs redacted)"; var t = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1.5) }; t.Tick += (_, _) => { CopyDiagButton.Content = "Copy All"; t.Stop(); };