Skip to content

[BUG] Popup v2 - App Crash with secondary Window #2700

@hwsmo

Description

@hwsmo

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

The new popup implementation released with version 12.0.0 doesn't work in a Windows Shell app and secondary windows. If I open a page in a new window and then try to open a popup, the app crashes.

The reason is that access to the current shell instance is done with Shell.Current in the PopupPage constructor. However, since the shell window is not active because the secondary window is active, this leads to the following exception:

throw new InvalidOperationException($"Unable to determine the current Shell instance you want to use. Please access Shell via the Windows property on {Application.Current.GetType()}.");

Expected Behavior

The popup will appear in the secondary window.

Steps To Reproduce

The new popup implementation released with version 12.0.0 doesn't work in a Windows Shell app and secondary windows. If I open a page in a new window and then try to open a popup, the app crashes.

Link to public reproduction project repository

Not required as it is very easy to adjust

Environment

- .NET MAUI CommunityToolkit: 12.0.0
- OS: Windows 11
- .NET MAUI: 9.0.70

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