Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Popup Dialog does not open when called from a Service after using Absolute Navigation. #3212

Open
askariya opened this issue Jul 24, 2024 · 0 comments

Comments

@askariya
Copy link

askariya commented Jul 24, 2024

Description

I have a service that handles showing popup dialogs using Prism's dialog service.
When I navigate to a page via Absolute Navigation, then trigger the popups from my custom popup service, the Prism Dialogs stop working. As far as I can tell, the ShowDialogAsync() call never seems to return.

Popups work just fine before any Absolute Navigation. I even tried doing absolute navigation back to the same page I was on and opening popups after, the issue still occurs once the Absolute Navigation happens.

Note: I found that if I set prism.ConfigureMopupDialogs(), then it works fine. You can control that with an ifdef I added in the MauiProgram.cs.

Steps to Reproduce

You can follow the steps in this video: https://github.com/user-attachments/assets/bba1b4bd-a7e7-454b-8f44-7e915a1b77ff
It shows popups being called directly from the viewmodel (LOCAL button) and from my service (SERVICE button).

The steps for reproducing are also below:

  1. Ensure prism.ConfigureMopupDialogs() is NOT set in your MauiProgram.cs when doing UsePrism(...).
  2. Navigate to a page with NavigationBuilder and include the UseAbsoluteNavigation() function. Note: CreateWindow can use Absolute Navigation without this issue occurring.
    var navResult = await _navigationService.CreateBuilder() .UseAbsoluteNavigation() .AddNavigationPage() .AddSegment<SecondPageViewModel>() .NavigateAsync();
  3. On the page that was navigated to, call the popup from a Service and not directly from a ViewModel.

When I do the above, the popup does not appear and the code never seems to return from the ShowDialogAsync() call.

Platform with bug

.NET MAUI

Affected platforms

Android

Did you find any workaround?

  • Utilizing Mopup Dialogs with prism.ConfigureMopupDialogs() appears to work in this scenario.
  • Calling the Popup from the ViewModel directly instead of a Service will also avoid the issue.

Relevant log output

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants