Skip to content

[Critical] ContentDialog causes memory leaks when ShowAsync task hangs #1618

@apachezy

Description

@apachezy

Describe the bug

Description

When ContentDialog.ShowAsync() tasks hang (e.g., when opening a new dialog before the previous one closes), it causes memory leaks because resources are not properly released.

Impact

  • Memory leaks: Large images, file handles, network connections, and event subscriptions are not disposed
  • Progressive degradation: Application memory usage grows over time
  • Potential crashes: May lead to OutOfMemoryException in long-running sessions

To Reproduce

ShowAsync-NoResult.mp4

Expected behavior

ShowAsync-Fixed.mp4

Screenshots

No response

OS version

Windows 11

.NET version

All

WPF-UI NuGet version

All

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions