Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.

[Bug] Navigating back from MediaElement and calling DisconnectHandler results in crash #1973

@sjorsmiltenburg

Description

@sjorsmiltenburg

Description

I have the mediaelement working on windows to play my video.
But when i navigate back and, as per the documentation, try to release the resources by calling
MyMediaElement.Handler?.DisconnectHandler();
during unload. It crashes with a Catastrophic Failure Exception.

I found multiple issues reporting this problem (like this one: CommunityToolkit/Maui#962), but all issues seem to have been closed as in "fixed". So I don't understand why I'm still seeing this behaviour with the latest version.
Or maybe the documentation is outdated and we no longer need to call the DisconnectHandler method??

I'm using

  • CommunityToolkit.Maui 5.2.0
  • CommunityToolkit.Maui.MediaElement 2.0.0

Stack Trace

Link to Reproduction Sample

a reproduction sample is here: https://github.com/sjorsmiltenburg/maui_bugs
if you press the button Bug5 you will see the crash on windows

Steps to Reproduce

  1. open repro sample
  2. click the bug 5 button
  3. navigate back

Expected Behavior

no crash

Actual Behavior

crash

Basic Information

  • Version with issue:
  • Last known good version:
  • IDE:
  • Platform Target Frameworks:
    • iOS:
    • Android:
    • Windows:
  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices:
  • MAUI Version:

Workaround

Don't call MyMediaElement.Handler?.DisconnectHandler();

Reproduction imagery

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working. Breaky break.maui-compat

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions