This repository was archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 456
This repository was archived by the owner on May 1, 2024. It is now read-only.
[Bug] MediaElement URI source throws ObjectDisposedException if return to previous page too early #1769
Copy link
Copy link
Closed
Labels
bugSomething isn't working. Breaky break.Something isn't working. Breaky break.
Description
Description
On Android, when using MediaElement URI source, there is a possibility that extracting metadata is taking a little longer, when it did taking a little longer and the MediaElementRenderer is already disposed by navigating to the previous page there will be ObjectDisposedException thrown
Stack Trace
at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in <00c315a988634383b446eff646084784>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in <00c315a988634383b446eff646084784>:0
at Android.Widget.VideoView.SetVideoURI (Android.Net.Uri uri, System.Collections.Generic.IDictionary`2[TKey,TValue] headers) [0x00041] in /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-30/mcw/Android.Widget.VideoView.cs:816
at Xamarin.CommunityToolkit.UI.Views.FormsVideoView.<>n__1 (Android.Net.Uri uri, System.Collections.Generic.IDictionary`2[TKey,TValue] headers) [0x00000] in <38847864b0e74b799fdf2eaad0701aed>:0
at Xamarin.CommunityToolkit.UI.Views.FormsVideoView.SetVideoURI (Android.Net.Uri uri, System.Collections.Generic.IDictionary`2[TKey,TValue] headers) [0x0007d] in <38847864b0e74b799fdf2eaad0701aed>:0
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021
at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/Android.App/SyncContext.cs:36
at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:36
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-30/mcw/Java.Lang.IRunnable.cs:84
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.39(intptr,intptr)
Link to Reproduction Sample
https://github.com/yunusefendi52/AppFixCommunityToolkitMedia
Steps to Reproduce
It's not a "one-liner" reproduce, but please see the reproduction sample above
Expected Behavior
Not crash ObjectDisposedException
Actual Behavior
crash ObjectDisposedException
Basic Information
- Version with issue: 1.3.1
- Last known good version: none
- IDE: VS for Mac
- Platform Target Frameworks:
- iOS:
- Android: Android 11 (API Level 30)
- UWP:
- Android Support Library Version:
- Nuget Packages: https://www.nuget.org/packages/Xamarin.CommunityToolkit/1.3.1
- Affected Devices:
Workaround
Uses reflection to invoke base base method (see repro above in AppFormsVideoView.cs)
Fixing
I think the fix is to check inside SetVideoURI (FormsVideoView.android.cs) if it's disposed or not. I don't mind to create PR for this if you think it is the fix
matheusouz
Metadata
Metadata
Assignees
Labels
bugSomething isn't working. Breaky break.Something isn't working. Breaky break.