the49ltd / The49.Maui.BottomSheet

.NET MAUI library used to display pages as Bottom Sheets
MIT License
334 stars 35 forks source link

Exception on iOS .Net 9 #145

Open trondwa opened 1 week ago

trondwa commented 1 week ago

The49 BottomSheet has worked just fine in my MAUI project using .Net 8 on both iOS and Android for several months. Last week I upgraded to .Net 9. The BottomSheet works as before on Android. However, on iOS I get an exception. I've tried to create an empy project only with this controller as well, but still no luck.

My code:

        var page = new BottomPage();

        page.HasBackdrop = true;
        page.CornerRadius = 10;

        var detent = new RatioDetent
        {               
            Ratio = 0.5F,
            BindingContext = page,
            IsEnabled = true,
            IsDefault = true
        };
        page.Detents.Add(detent);

        try
        {
            page.ShowAsync(Window);   //The exception happens here
        }
        catch (Exception ex)
        {

            throw;
        }

Exception: Object reference not set to an instance of an object.

Stacktrace: at The49.Maui.BottomSheet.BottomSheetHandler.PlatformMapSelectedDetent(BottomSheet view) at The49.Maui.BottomSheet.BottomSheetHandler.MapSelectedDetent(BottomSheetHandler handler, BottomSheet view) at Microsoft.Maui.PropertyMapper2.<>c__DisplayClass5_0[[The49.Maui.BottomSheet.BottomSheet, The49.Maui.BottomSheet, Version=8.0.4.0, Culture=neutral, PublicKeyToken=null],[The49.Maui.BottomSheet.BottomSheetHandler, The49.Maui.BottomSheet, Version=8.0.4.0, Culture=neutral, PublicKeyToken=null]].<Add>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.Handlers.ViewHandler2[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.ContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IView view) at Microsoft.Maui.Handlers.ContentViewHandler.SetVirtualView(IView view) at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.IContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.ContentView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view) at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler) at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value) at Microsoft.Maui.Controls.VisualElement.set_Handler(IViewHandler value) at The49.Maui.BottomSheet.BottomSheet.ShowAsync(IWindow parent, Boolean animated, Boolean aboveEverything) at Skandia.BottomSheetTest.Pages.MainPage.Button_Clicked(Object sender, EventArgs e) in C:\Source\Skandia.BottomSheetTest\Pages\MainPage.xaml.cs:line 35

Anyone experiencing the same? Someone with a solution?

imadofficial commented 1 week ago

Yes, i'm experiencing the same issues.

trondwa commented 1 week ago

Yes, i'm experiencing the same issues.

Ok. And I assume you didn't find a solution? Too bad as I really like the Bottomsheet component.

imadofficial commented 1 week ago

Not really, i'm currently experimenting with https://github.com/softlion/The49.Maui.BottomSheet to see if i can get it to work somehow

trondwa commented 1 week ago

Not really, i'm currently experimenting with https://github.com/softlion/The49.Maui.BottomSheet to see if i can get it to work somehow

Let me know if you make it :) Looked briefly at the isses on that one and unfortunately it seems like there's trouble with iOS there as well.