AndreiMisiukevich / CardView

CardsView | CarouselView | CoverflowView | CubeView for Xamarin.Forms
MIT License
710 stars 114 forks source link

CardsView.OnSizeChanged () System.NullReferenceException: Object reference not set to an instance of an object #404

Closed hafilpallippadi closed 2 years ago

hafilpallippadi commented 2 years ago

I am getting error in android :

CardsView.OnSizeChanged () System.NullReferenceException: Object reference not set to an instance of an object

Stack traces CardsView.OnSizeChanged () AsyncMethodBuilderCore+<>c.b__7_0 (System.Object state)

Affected OS : Android 9 and 11

Here is the XAML:

<cards:CarouselView
                            x:Name="carouselViewControl"
                            Grid.Row="1"
                            AutomationId="homePageCarousel"
                            BackgroundColor="White"
                            HeightRequest="{Binding PromoCarouselHeight}"
                            IsUserInteractionRunning="{Binding IsCarouselUserInteracting}"
                            ItemsSource="{Binding PromoBanners}"
                            SelectedIndex="{Binding CarouselIndex}">
                            <cards:CarouselView.ItemTemplate>
                                <DataTemplate>
                                    <home:RewardsPromoView />
                                </DataTemplate>
                            </cards:CarouselView.ItemTemplate>
                            <ctrl:IndicatorsControl SelectedIndicatorStyle="{StaticResource ActiveIndicator}"
                                                UnselectedIndicatorStyle="{StaticResource InactiveIndicator}" />
</cards:CarouselView>

The crash occurs when I minimize the app and open it after sometime

@AndreiMisiukevich

AndreiMisiukevich commented 2 years ago

@hafilpallippadi thanks for your report Would you like to take ownership of this issue and debug it by running a test sample? So you can find which element is null and then fix it by submitting a PR.

AndreiMisiukevich commented 2 years ago

I don't see any line of code in a mentioned method which can cause a null ref. Maybe

AndreiMisiukevich commented 2 years ago

Cannot reproduce. Please provide a sample. Closing it until sample is provided :)