You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Popup v2 - App Crash with secondary Window #2700
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.
Hi @@hwsmo! We have added the
needs reproduction
label to this issue, which indicates that we are unable to take further action until you provide a reproduction sample that we can use to reproduce + fix your bug. In accordance with the Reporting a bug section of our Contributing.md that you confirmed reading before you submitted this Issue, we ask that every Issue author provide a link to an open-source repository containing the reproduction sample app. This issue will be closed automatically in 5 days if we do not receive a reproduction sample from you. Please feel free to re-open this Issue once you have provided a reproduction sample.
@bijington That's right, Shell.SetPresentationMode() is called again at the end. Maybe that would be the solution. Anyway, I would be happy, because my Popup v2 migration is done, but unfortunately this is currently the show stopper.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 3 days. It will be closed if no further activity occurs within 2 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.
Activity
VladislavAntonyuk commentedon Jun 11, 2025
In that case, we allow you to use INavigation. It is not necessary to be a Shell.
dotnet-policy-service commentedon Jun 11, 2025
Hi @@hwsmo! We have added the needs reproduction label to this issue, which indicates that we are unable to take further action until you provide a reproduction sample that we can use to reproduce + fix your bug. In accordance with the
Reporting a bugsection of ourContributing.mdthat you confirmed reading before you submitted this Issue, we ask that every Issue author provide a link to an open-source repository containing the reproduction sample app. This issue will be closed automatically in 5 days if we do not receive a reproduction sample from you. Please feel free to re-open this Issue once you have provided a reproduction sample.hwsmo commentedon Jun 11, 2025
@VladislavAntonyuk Unfortunately, this is not the solution, because even then an instance of PopUpPage is created:
and the current shell instance is accessed via Shell.Current:
Maui/src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs
Line 46 in 91b5e91
However, accessing Shell.Current requires that the shell window is "Active":
And that is exactly what leads to the exception and the app crash.
bijington commentedon Jun 11, 2025
Do we need to call
SetPresentationModeon shell when we call it at the end of the constructor onthis?hwsmo commentedon Jun 11, 2025
@bijington That's right, Shell.SetPresentationMode() is called again at the end. Maybe that would be the solution. Anyway, I would be happy, because my Popup v2 migration is done, but unfortunately this is currently the show stopper.
dotnet-policy-service commentedon Jun 16, 2025
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 3 days. It will be closed if no further activity occurs within 2 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.
TheCodeTraveler commentedon Jun 16, 2025
Fixed in #2716