xamarin / XamarinCommunityToolkit

The Xamarin Community Toolkit is a collection of Animations, Behaviors, Converters, and Effects for mobile development with Xamarin.Forms. It simplifies and demonstrates common developer tasks building iOS, Android, and UWP apps with Xamarin.Forms.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

sjorsmiltenburg opened this issue · comments

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

sorry, i seem to have opened this issue on the wrong repo. I've opened a new one on the maui repo: CommunityToolkit/Maui#1245
this one can be closed