-
Notifications
You must be signed in to change notification settings - Fork 466
Description
Is there an existing issue for this?
- I have searched the existing issues
Did you read the "Reporting a bug" section on Contributing file?
- I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
Current Behavior
When opening a Popup when screen mirroring is active. The app crashes with a System.InvalidOperationException.
System.InvalidOperationException: ViewController cannot be null. at CommunityToolkit.Maui.Core.Views.MauiPopup.SetElement(IPopup element) in /_/src/CommunityToolkit.Maui.Core/Views/Popup/MauiPopup.macios.cs:line 80 at CommunityToolkit.Maui.Core.Handlers.PopupHandler.ConnectHandler(MauiPopup platformView) in /_/src/CommunityToolkit.Maui.Core/Handlers/Popup/PopupHandler.macios.cs:line 91 at Microsoft.Maui.Handlers.ElementHandler2[[CommunityToolkit.Maui.Core.IPopup, CommunityToolkit.Maui.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[CommunityToolkit.Maui.Core.Views.MauiPopup, CommunityToolkit.Maui.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].OnConnectHandler(Object platformView)
at Microsoft.Maui.Handlers.ElementHandler.ConnectHandler(Object platformView)
at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view)
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value)
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context)
at CommunityToolkit.Maui.Views.PopupExtensions.CreatePopup(Page page, Popup popup) in //src/CommunityToolkit.Maui/Views/Popup/PopupExtensions.shared.cs:line 89
at CommunityToolkit.Maui.Views.PopupExtensions.CreateAndShowPopupAsync[ToolkitPopupPage](Page page, ToolkitPopupPage popup) in //src/CommunityToolkit.Maui/Views/Popup/PopupExtensions.shared.cs:line 113
at CommunityToolkit.Maui.Views.PopupExtensions.ShowPopupAsync[ToolkitPopupPage](Page page, ToolkitPopupPage popup) in /_/src/CommunityToolkit.Maui/Views/Popup/PopupExtensions.shared.cs:line 57
at MauiApp1.MainPage.OnOpenToolkitPopupPage(Object sender, EventArgs e) in /Users/user/RiderProjects/MauiApp1/MauiApp1/MainPage.xaml.cs:line 24
at System.Threading.Tasks.Task.<>c.b__128_0(Object )
at Foundation.NSAsyncSynchronizationContextDispatcher.Apply()
at UIKit.UIApplication.UIApplicationMain(Int32 , String[] , IntPtr , IntPtr )
at UIKit.UIApplication.Main(String[] , Type , Type )
at MauiApp1.Program.Main(String[] args) in /Users/user/RiderProjects/MauiApp1/MauiApp1/Platforms/iOS/Program.cs:line 13`
Expected Behavior
The popup should behave the same as on the device. This is very annoying when demo MAUI apps when the app crashes.
Steps To Reproduce
- Create a Popup in you're application
- Add a button that opens the popup
- Start screen mirroring on the device (i've tested it on an iPad with iOS 16.4)
- Open the app
- Click the button that opens the popup
- The app crashes...
Link to public reproduction project repository
https://github.com/imuller/app-popups-problem
Environment
- .NET MAUI CommunityToolkit: 5.1.0
- OS: iOS 16.4 running on and iPad Pro
- .NET MAUI: 7.0.81Anything else?
No response