Skip to content

[BUG] Media Element cannot be disconnected #2388

@cagriy

Description

@cagriy

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

Upon exiting a page that has a MediaElement, although calling the DisconnectHandler as recommended, MediaElement does not get removed.

Expected Behavior

MediaElement should be garbage collected.

Steps To Reproduce

  1. Open and run the solution from the reproduction repository
  2. Click the button to go to the second page where the memory element lives
  3. Click the back button to go to the main page
  4. Check gcdump vie heapview and search for MediaElement

Link to public reproduction project repository

https://github.com/cagriy/MemoryLeak9

Environment

- .NET MAUI CommunityToolkit Media Element: 5.0.0
- OS: iOS 18.1
- .NET MAUI: 9.0.21

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working📽️ MediaElementIssue/PR that has to do with MediaElement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions