Skip to content

Commit 35dc570

Browse files
Copilotemako
andcommitted
Add try-catch wrapper around ShowBalloonTip to prevent crash on startup
Co-authored-by: emako <24737061+emako@users.noreply.github.com>
1 parent d397e15 commit 35dc570

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

QuickLook/TrayIconManager.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,19 @@ public static void ShowNotification(string title, string content, bool isError =
149149
Action closeEvent = null)
150150
{
151151
var icon = GetInstance()._icon;
152-
icon.ShowBalloonTip(timeout, title, content, isError ? ToolTipIcon.Error : ToolTipIcon.Info);
153-
icon.BalloonTipClicked += OnIconOnBalloonTipClicked;
154-
icon.BalloonTipClosed += OnIconOnBalloonTipClosed;
152+
153+
try
154+
{
155+
icon.ShowBalloonTip(timeout, title, content, isError ? ToolTipIcon.Error : ToolTipIcon.Info);
156+
icon.BalloonTipClicked += OnIconOnBalloonTipClicked;
157+
icon.BalloonTipClosed += OnIconOnBalloonTipClosed;
158+
}
159+
catch (MissingMethodException)
160+
{
161+
// Fallback: ShowBalloonTip method signature may have changed in the library
162+
// Try alternative approach or silently fail to prevent crash
163+
System.Diagnostics.Debug.WriteLine($"ShowBalloonTip failed: {title} - {content}");
164+
}
155165

156166
void OnIconOnBalloonTipClicked(object sender, EventArgs e)
157167
{

0 commit comments

Comments
 (0)