Skip to content

Crash showing image-preview toast when desktop composition is unavailable #64

Description

@valkenrath

Summary

OddSnap terminates after a capture when the image-preview toast is shown while Windows desktop composition is unavailable. The same crash occurred on 0.8.44 and 0.8.45.

Environment

  • Windows 11, build 26100
  • OddSnap 0.8.44 and 0.8.45 (x64)
  • .NET 9.0.16 and 9.0.17 respectively

Observed behavior

The process terminates due to an unhandled System.Runtime.InteropServices.COMException from DwmExtendFrameIntoClientArea while creating ToastWindow after a capture.

Two occurrences were recorded one week apart. Both have exception code 0x80263001 and the same call path.

Expected behavior

OddSnap should continue running. If DWM composition/backdrops are unavailable, the preview toast should fall back to a plain window or be skipped.

Diagnostic evidence

Application: OddSnap.exe
OddSnap versions observed: 0.8.44.0, 0.8.45.0
CoreCLR versions observed: 9.0.1626.22923, 9.0.1726.26416
.NET versions observed: 9.0.16, 9.0.17

Description: The process was terminated due to an unhandled exception.
Exception Info: System.Runtime.InteropServices.COMException (0x80263001):
{Desktop composition is disabled} The operation could not be completed because
desktop composition is disabled. (0x80263001)

at Standard.NativeMethods.DwmExtendFrameIntoClientArea(IntPtr hwnd, MARGINS& pMarInset)
at System.Windows.Appearance.WindowBackdropManager.UpdateGlassFrame(IntPtr hwnd, WindowBackdropType backdropType)
at System.Windows.Appearance.WindowBackdropManager.ApplyBackdrop(IntPtr hwnd, WindowBackdropType backdropType)
at System.Windows.Appearance.WindowBackdropManager.SetBackdrop(Window window, WindowBackdropType backdropType)
at System.Windows.ThemeManager.ApplyStyleOnWindow(Window window, Boolean useLightColors)
at System.Windows.ThemeManager.ApplyStyleOnWindow(Window window)
at System.Windows.Window.CreateSourceWindow(Boolean duringShow)
at System.Windows.Window.ShowHelper(Object booleanBox)
at System.Windows.Window.Show()
at OddSnap.UI.ToastWindow.Show(ToastSpec spec)
at OddSnap.UI.ToastWindow.ShowImagePreview(Bitmap screenshot, String title, String body, String filePath, Boolean autoPin)
at OddSnap.UI.ToastWindow.ShowImagePreview(Bitmap screenshot, String filePath, Boolean autoPin)
at OddSnap.App.<>c__DisplayClass44_1.<HandleCaptureResult>b__2()

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