dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.28k stars 1.76k forks source link

[iOS] Media Picker UIImagePickerController closing issue #21996

Open amahera opened 7 months ago

amahera commented 7 months ago

Description

If we use await MediaPicker.Default.PickPhotoAsync() and then try to open alert - await DisplayAlert(result?.FileName, "message", "ok") -alert won't be displayed.

I believe that this is an issue with setting the result of image picking before closing UIImagePickerController.

Steps to Reproduce

  1. Call and await MediaPicker.Default.PickPhotoAsync()
  2. Try to open alert await DisplayAlert(result?.FileName, "message", "ok")
  3. Verify that the alert is not shown

Link to public reproduction project repository

https://github.com/amahera/media-picker-repoduction-issue

Version with bug

8.0.20 SR4

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

No response

Did you find any workaround?

add some delay before DisplayAlert

Relevant log output

No response

jaosnz-rep commented 7 months ago

Can repro this issue at iOS platform on the latest 17.10 Preview 5(8.0.21 & 8.0.20 & 8.0.14).

SchittkowskiMS commented 2 months ago

Same issue here, can be worked arround by adding task.delay for 750ms. Would be nice if this would get fixed as the 750ms is just a guess and works right now, maybe this breaks on older devices as they take more time to close the dialog

MitchBomcanhao commented 6 days ago

running into similar issues, where trying to use the media picker (which doesn't work) will then permanently block display alerts from being displayed, rendering a good portion of the app inoperable. running maui 9.0.10