Skip to content

System tray custom tooltip causes unhandled WPF crash #422

@erikdarlingdata

Description

@erikdarlingdata

Problem

The custom TrayToolTip in SystemTrayService.cs (a Border + TextBlock element) triggers an unhandled WPF crash:

ArgumentException: The root Visual of a VisualTarget cannot have a parent.
   at System.Windows.Media.CompositionTarget.SetRootVisual(Visual visual)
   ...
   at System.Windows.Controls.Primitives.Popup.CreateWindow(Boolean asyncCall)
   ...
   at Hardcodet.Wpf.TaskbarNotification.TaskbarIcon.OnToolTipChange(Boolean visible)

This is a known bug in Hardcodet.NotifyIcon.Wpf — a race condition in Popup.CreateWindow when toggling custom visual tooltips. The issue is open since 2020 with no fix. The library is effectively unmaintained.

A secondary crash follows (Popup.OnWindowResize NullReferenceException) as the corrupted popup state cascades.

Impact

The crash itself doesn't terminate the app (the unhandled exception handler catches it), but it corrupts internal state that poisons the DuckDB ReaderWriterLockSlim on the UI thread, breaking all Overview tab queries permanently until restart. See #423 for locking resilience.

Fix

Replace the custom visual TrayToolTip with the simple string ToolTipText property. The plain string tooltip doesn't use WPF's Popup infrastructure and avoids the race condition entirely. The custom tooltip is just themed text — not worth the crash risk.

Observed

  • Crash log from 2026-03-04 at 12:00:06 and 13:25:04
  • Both times at TaskbarIcon.OnToolTipChange line 483
  • Affected all 4 monitored servers (overview stopped updating)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions