jamesmontemagno/MediaPlugin

Crashing if you didn't pick photo on Pixel 5 simulator with null reference exception

MhAllan opened this issue · 1 comments

If you didn't pick any photo and clicked the back button on Pixel 5 simulator it will crash with null reference exception and the exception is not catchable even which is weird

 public async Task<MediaFile> PickPhoto()
        {
            try
            {
                await CrossMedia.Current.Initialize();

                if (!CrossMedia.Current.IsPickPhotoSupported)
                {
                    throw new Exception(":not supported");
                }

                return await CrossMedia.Current.PickPhotoAsync();
            }
            catch(Exception ex) // this is not reachable
            {
                return null;
            }
            finally
            {
                Toast("Done"); // this is also not reachable
            }
        }

image

Unable to reproduce issue with latest beta packages.