jamesmontemagno/MediaPlugin

App crashing with System.ArgumentNullException

Maxima078 opened this issue · 1 comments

When I use PickPhotosAsync it crashs my app with some files. Those files are all in "Downloads" folder within my Xiaomi mi 9, Android 9. I cannot try/catch. Here is the trace:

12-01 12:27:47.279 E/mono-rt (28110): [ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentNullException: Value cannot be null.
12-01 12:27:47.279 E/mono-rt (28110): Parameter name: collection
12-01 12:27:47.279 E/mono-rt (28110):   at System.Collections.Generic.List`1[T].InsertRange (System.Int32 index, System.Collections.Generic.IEnumerable`1[T] collection) [0x00003] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/List.cs:723 
12-01 12:27:47.279 E/mono-rt (28110):   at System.Collections.Generic.List`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] collection) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/List.cs:257 
12-01 12:27:47.279 E/mono-rt (28110):   at Plugin.Media.MediaPickerActivity.OnActivityResult (System.Int32 requestCode, Android.App.Result resultCode, Android.Content.Intent data) [0x00132] in d:\a\1\s\src\Media.Plugin\Android\MediaPickerActivity.cs:374 
12-01 12:27:47.279 E/mono-rt (28110):   at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.1(intptr,intptr)
12-01 12:27:47.279 E/mono-rt (28110):   at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.1(intptr,intptr)

Using single PickPhotoAsync also failed but I can process the error.

Bug Information

Version Number of Plugin: 5.0.1
Device Tested On: iPhone XR
Version of VS: 16.7.7
Version of Xamarin: 16.7.000.463

Steps to reproduce the Behavior

Call PickPhotosAsync and select one or more picture from "Downloads" folder (not sur about the folder as source of error)

Expected Behavior

We should be able to try/catch any error or get null results

Actual Behavior

App crashs

Unable to reproduce here in the sample in the repo