Skip to content

Lite and the Darling Viewer: 18 unguarded clipboard writes can crash the app when the clipboard is busy #4594

Closed

Description

@erikdarlingdata

Every clipboard write in Lite and the Darling Viewer outside the shared plan viewer still calls Clipboard.SetText/SetDataObject unguarded. When another program holds the Windows clipboard, WPF throws COMException (CLIPBRD_E_CANT_OPEN), and in a click handler that ends the app.

#4582 (PR #4593) adds a guarded writer, ClipboardText.TrySetText in PerformanceMonitor.Ui, with the same bounded retry as the existing guarded reader. It routes the shared plan viewer, blocking chain, deadlock graph and grid-export copies through it. The same unguarded pattern remains at 18 sites:

  • Lite: Helpers/ContextMenuHelper.cs (4, including the chart bitmap copy), Controls/ServerTab.CopyExport.cs, Controls/RecommendationsTab.xaml.cs (2), Windows/SettingsWindow.xaml.cs, Windows/AlertDetailWindow.xaml.cs, and Windows/EntraDeviceCodeWindow.xaml.cs.
  • The Darling Viewer: MainWindow.xaml.cs (3), ViewerServerTab.CopyExport.cs, ViewerServerTab.ChartContextMenu.cs, SettingsWindow.xaml.cs (2), and AlertDetailWindow.xaml.cs.

The fix is mechanical: route each through ClipboardText.TrySetText (and a bitmap-capable overload for the chart copy), and pin with a census that no unguarded Clipboard.Set* call is left outside ClipboardText. deprecated/ is out of scope.

Found while porting erikdarlingdata/PerformanceStudio@7cd9218's clipboard guard for #4582. At 08f3e3c4e.

Activity

  1. erikdarlingdata commented on Sep 28, 2026

    @erikdarlingdata
    OwnerAuthor

    Closed by the watcher: delivered in PR #4600, merged to dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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