radimitrov / CSharpShellApp

83 stars 18 forks source link

Popup #331

Closed tyronemagwade closed 11 months ago

tyronemagwade commented 11 months ago

I tried implementing a built in Popup. It keeps on throwing this exception System.ArgumentNullException: Value cannot be null. (Parameter 'handler.Container') at CommunityToolkit.Maui.Core.Handlers.PopupHandler.MapSize(PopupHandler handler, IPopup view) at Microsoft.Maui.PropertyMapper2.<>cDisplayClass5_0[[CommunityToolkit.Maui.Core.IPopup, CommunityToolkit.Maui.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[CommunityToolkit.Maui.Core.Handlers.PopupHandler, CommunityToolkit.Maui.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].b__0(IElementHandler h, IElement v) at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView) at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView) 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) at CommunityToolkit.Maui.Views.PopupExtensions.CreateAndShowPopup[NotesPopup](Page page, NotesPopup popup) at CommunityToolkit.Maui.Views.PopupExtensions.ShowPopup[NotesPopup](Page page, NotesPopup popup) at Church.Views.ProfilePage.OnItemSelected(Object sdr, EventArgs e) at System.Threading.Tasks.Task.<>c.b128_0(Object state) at Android.App.SyncContext.<>cDisplayClass2_0.b__0() at Java.Lang.Thread.RunnableImplementor.Run() at Java.Lang.IRunnableInvoker.n_Run(IntPtr jnienv, IntPtr nativethis) at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V callback, IntPtr jnienv, IntPtr klazz)`

radimitrov commented 11 months ago

@tyronemagwade I'm not sure what may be wrong here. I tried a XAML Popup example and it worked. Next update (3.1.58) should improve stack traces and potentially help here.

tyronemagwade commented 11 months ago

@radimitrov I'm still get the same exception after updating. Do you mind if you show me how you tested it

radimitrov commented 11 months ago

@tyronemagwade PopupTest.zip

tyronemagwade commented 11 months ago

@radimitrov thanks it's working. I found the main reason why it was throwing exception, it need to have views/children inside it