Mediaplugin: [iOS] App crash after double tap on a photo

Created on 15 Apr 2021  路  6Comments  路  Source: jamesmontemagno/MediaPlugin

Bug Information

Version Number of Plugin: 5.0.1.1
Device Tested On: iPhone 11, iOS 14.3
Simulator Tested On: n/a
Version of VS: 16.9.3
Version of Xamarin: 16.9
Versions of other things you are using: Xamarin.Essential 1.6.1

Unfortunately Xamarin.essentials.MediaPicker is currently missing many options to be able to migrate.

Steps to reproduce the Behavior

Open gallery and double tap on any photo

Expected Behavior

Photo selected (or at least no crash)

Actual Behavior

App throws exception and crashes

Code snippet

            var fileMedia = await CrossMedia.Current.PickPhotoAsync(new PickMediaOptions());

            if (fileMedia != null)
            {
                //
            }

Screenshots

image

Callstack

Exception : System.ObjectDisposedException
Message : Cannot access a disposed object.
Object name: 'Foundation.InternalNSNotificationHandler'.
StackTrace :   at ObjCRuntime.ThrowHelper.ThrowObjectDisposedException (System.Object o) [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/ThrowHelper.cs:34 
  at ObjCRuntime.NativeObjectExtensions.GetNonNullHandle (ObjCRuntime.INativeObject self, System.String argumentName) [0x0001b] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/INativeObject.cs:29 
  at Foundation.NSNotificationCenter.RemoveObserver (Foundation.NSObject observer) [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/ios/native/Foundation/NSNotificationCenter.g.cs:179 
  at Plugin.Media.MediaPickerDelegate.RemoveOrientationChangeObserverAndNotifications () [0x00012] in d:\a\1\s\src\Media.Plugin\iOS\MediaPickerDelegate.cs:197 
  at Plugin.Media.MediaPickerDelegate.FinishedPickingMedia (UIKit.UIImagePickerController picker, Foundation.NSDictionary info) [0x00037] in d:\a\1\s\src\Media.Plugin\iOS\MediaPickerDelegate.cs:52 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021 
  at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSAction.cs:178 
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:65 
  at iOS.Application.Main (System.String[] args) [0x00001] in Main.cs:12 

Most helpful comment

Im also having this issue with my App. More than 100+ crashes are occuring due to this. Please fix this issue asap and revert.

All 6 comments

Im also having this issue with my App. More than 100+ crashes are occuring due to this. Please fix this issue asap and revert.

I have same bug. please fix issue.

Is this issue fixed?

I have same issue. Any fix?

Any update on this issue? So many crashes are happening in our App due to this plugin issue.

I wouldn鈥檛 be expecting a fix soon unless someone adopts the project. The plugin project was archived last year. See the main page for details.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Julien-Mialon picture Julien-Mialon  路  7Comments

ivmazurenko picture ivmazurenko  路  3Comments

Greg-Freeman picture Greg-Freeman  路  7Comments

MartinRobins picture MartinRobins  路  8Comments

jamesmontemagno picture jamesmontemagno  路  4Comments