Skip to content

[BUG] PopupV2 PopupService.ShowPopupAsync<T> view model assigned to the popup is created twice. #3065

@vyefymochkyn

Description

@vyefymochkyn

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

When I have my popup registered as transient Service.AddTransientPopup<MyPopup, MyViewModel>(), and try to show the popup using PopupService.ShowPopupAsync(...) - viewmodel behind is created twice.
Attaching sample empty app which helps to reproduce the issue.

Expected Behavior

When I show the popup using PopupService.ShowPopupAsync(...) - I expect single view and viewmodel to be created to serve this call.

Steps To Reproduce

  1. Open attached solution
  2. Click default Click me button which navigates you to next Page
  3. Click on Open Popup

In debug you can observe that constructor for ViewModel has been called twice.

Link to public reproduction project repository

https://github.com/vyefymochkyn/maui-popup-issue

Environment

- .NET MAUI CommunityToolkit: 12.3

dotnet --version
9.0.306

Installed Workload Id      Manifest Version       Installation Source
---------------------------------------------------------------------
android                    35.0.105/9.0.100       SDK 9.0.300        
ios                        26.0.9752/9.0.100      SDK 9.0.300        
maui                       9.0.111/9.0.100        SDK 9.0.300        
maui-maccatalyst           9.0.111/9.0.100        SDK 9.0.300

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions