Is there an existing issue for this?
Did you read the "Reporting a bug" section on Contributing file?
Current Behavior
When repeatedly opening and closing a CommunityToolkit.Maui.Views.Popup on iOS, the following exception is eventually thrown:
CommunityToolkit.Maui.Views.PopupNotFoundException
Unable to close popup: could not locate PopupPage.
I suspect this happens because CloseAsync() can be triggered multiple times for the same popup instance, causing the internal popup state to become invalid.
Observed behavior:
Popup opens/closes normally at first
After repeated open/close cycles the exception is thrown
In some cases the app terminates afterwards on iOS
Expected Behavior
Calling CloseAsync() multiple times should either be ignored safely or handled gracefully without throwing PopupNotFoundException.
Steps To Reproduce
-
Clone and run the reproduction repository on iOS (preferably on a physical device).
-
Open the popup using the button on the main page.
-
Close the popup using the button inside the popup.
Additional notes:
- The issue is easier to reproduce on a physical iPhone.
- Rapidly tapping both buttons with two fingers seems to increase the likelihood significantly.
- Rapid double tapping outside the popup backdrop may potentially be the actual trigger, but this could not be confirmed yet.
- The exception usually appears after a few minutes of repeated interaction.
Link to public reproduction project repository
https://github.com/MatthewJer/TestPopup
Environment
* .NET MAUI CommunityToolkit: 14.1.1
* OS: iOS (physical device)
* .NET MAUI: 10.0.60
* Xcode: 26.4
* Reproduced on: iPhone
Anything else?
A potentially related issue was previously reported here:
However, that report contains less detail and I could not find other issues clearly matching this behavior.
Since I now have:
- a minimal reproduction repository
- a fairly reliable reproduction path
- and additional observations regarding rapid repeated interactions
I decided to open a dedicated issue.
At the moment, this is currently our number one crash cause on iOS.
Any suggested workarounds or mitigation strategies would be highly appreciated while waiting for a proper fix.
Observed stacktrace:
Unable to close popup: could not locate PopupPage. ShowPopup or ShowPopupAsync must be called before CloseAsync. If using a custom implementation of Popup, override the CloseAsync method
at CommunityToolkit.Maui.Views.PopupPage.CloseAsync(PopupResult result, CancellationToken token) in /_/src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs:line 86
at MauiApp1.MyPopup.Button_Clicked(Object sender, EventArgs e) in /Volumes/SDCard/WorkSpace/PopupTest/Popups/MyPopup.xaml.cs:line 14
at System.Threading.Tasks.Task.<>c.b__124_0(Object state)
at Foundation.NSAsyncSynchronizationContextDispatcher.Apply()
Is there an existing issue for this?
Did you read the "Reporting a bug" section on Contributing file?
Current Behavior
When repeatedly opening and closing a CommunityToolkit.Maui.Views.Popup on iOS, the following exception is eventually thrown:
CommunityToolkit.Maui.Views.PopupNotFoundException
Unable to close popup: could not locate PopupPage.
I suspect this happens because CloseAsync() can be triggered multiple times for the same popup instance, causing the internal popup state to become invalid.
Observed behavior:
Popup opens/closes normally at first
After repeated open/close cycles the exception is thrown
In some cases the app terminates afterwards on iOS
Expected Behavior
Calling CloseAsync() multiple times should either be ignored safely or handled gracefully without throwing PopupNotFoundException.
Steps To Reproduce
Clone and run the reproduction repository on iOS (preferably on a physical device).
Open the popup using the button on the main page.
Close the popup using the button inside the popup.
Additional notes:
Link to public reproduction project repository
https://github.com/MatthewJer/TestPopup
Environment
Anything else?
A potentially related issue was previously reported here:
However, that report contains less detail and I could not find other issues clearly matching this behavior.
Since I now have:
I decided to open a dedicated issue.
At the moment, this is currently our number one crash cause on iOS.
Any suggested workarounds or mitigation strategies would be highly appreciated while waiting for a proper fix.
Observed stacktrace:
Unable to close popup: could not locate PopupPage. ShowPopup or ShowPopupAsync must be called before CloseAsync. If using a custom implementation of Popup, override the CloseAsync method
at CommunityToolkit.Maui.Views.PopupPage.CloseAsync(PopupResult result, CancellationToken token) in /_/src/CommunityToolkit.Maui/Views/Popup/PopupPage.shared.cs:line 86
at MauiApp1.MyPopup.Button_Clicked(Object sender, EventArgs e) in /Volumes/SDCard/WorkSpace/PopupTest/Popups/MyPopup.xaml.cs:line 14
at System.Threading.Tasks.Task.<>c.b__124_0(Object state)
at Foundation.NSAsyncSynchronizationContextDispatcher.Apply()