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
22k stars 1.72k forks source link

When PickContactAsync() returns, it prevents other windows to show #20383

Open borrmann opened 7 months ago

borrmann commented 7 months ago

Description

I pick a contact. If there is more than one phone number, I want to ask the user which number he wants to pick. When I open a new DisplayActionSheet, it doesn't open. I tried to use the49 BottomSheet instead, which does open for a moment, but is then dismissed.

var contact = await Microsoft.Maui.ApplicationModel.Communication.Contacts.Default.PickContactAsync();
var phones = contact.Phones.Select(x => x.PhoneNumber).ToList();
string res = await Application.Current.MainPage.DisplayActionSheet("chosse a number", "cancel", null, [.. phones]);

Steps to Reproduce

  1. Pick a contact
  2. Show a DisplayActionSheet or another window
  3. The DisplayActionSheet does not show

Link to public reproduction project repository

https://github.com/borrmann/DialogClosesWindows

Version with bug

8.0.3

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

7.0.49

Affected platforms

iOS

Affected platform versions

iOS 17, not sure about other

Did you find any workaround?

before opening another window, add a delay of 1000ms. Strangely, 500ms is not enough. await Task.Delay(1000); string res = await Application.Current.MainPage.DisplayActionSheet("chosse a number", "cancel", null, [.. phones]);

Relevant log output

No response

ghost commented 7 months ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

kevinxufei commented 4 weeks ago

This issue has been verified using Visual Studio 17.12.0 Preview 1.0(8.0.80 & 8.0.3), Can repro it. and works fine on 17.11.1 (7.0.49). It is a regression from .NET 7 to .NET 8. Add workaround as prompted "await Task.Delay(1000);" Can work normally.

dotnet-policy-service[bot] commented 4 weeks ago

Hi @borrmann. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.