1

When the content of the cart is loaded a first time, everything goes well. When I refresh it, the program crashes. On Android everything is fine.

<CollectionView ItemsSource="{Binding Cart}" 
                            SelectionMode="Multiple" 
                            SelectedItems="{Binding SelectedItemsInCart}" 
                            SelectionChanged="On_SelectionChanged"
                            EmptyView="No ingredients in your cart" 
                            x:Name="collectionView"
                            HorizontalOptions="Center">
                <CollectionView.ItemTemplate>
                    <DataTemplate>
                        <SwipeView>
                            <SwipeView.RightItems>
                                <SwipeItems >
                                    <SwipeItem Text="Delete"
                                   IconImageSource="trash.png"
                                   BackgroundColor="LightPink"
                                   Command="{Binding RemoveFromCartCommand}"
                                   CommandParameter="{Binding}" />
                                </SwipeItems>
                            </SwipeView.RightItems>
                            <Grid RowDefinitions="auto, auto" x:DataType="model:Ingredient">
                                <Label Grid.Row="0" Text="{Binding Name}" FontAttributes="Bold" FontSize="20" HorizontalOptions="Center"/>
                                <Label Grid.Row="1" Text="{Binding Quantity}" FontSize="15" HorizontalOptions="Center"/>
                            </Grid>
                        </SwipeView>
                    </DataTemplate>
                </CollectionView.ItemTemplate>
            </CollectionView>

And the error is not very helpful:

Unhandled exception at 0x00007FFB117CE1EF (combase.dll) in CookUs.exe: 0xC0000602: A FailFast exception has occurred. Exception handlers will not be called and the process will terminate immediately.

Without the SwipeView, everything's fine. The SwipeView seems to simply not be supported on Windows, even disabling it if the platform is Windows still makes the program crash.

Abristonks
  • 83
  • 6
  • 1
    What is the exception? What does the stack trace and logs how? – Jason Dec 15 '22 at 18:51
  • I'm not sure as to what exactly may be causing this. However, you shouldn't nest views that support scrolling inside each other. Just like you shouldn't nest a CollectionView inside a ScrollView, I can imagine that you also shouldn't nest a CollectionView inside a SwipeView or vice versa: https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/scrollview?view=net-maui-7.0 – Julian Dec 15 '22 at 18:52
  • Could be related to this: https://stackoverflow.com/questions/74815868/net-maui-can-we-also-have-platform-specific-xaml Which platform does the crash occur on? Android or iOS or both (or others)? And please update your question with the exception, it will make it easier for others to understand what's going on. – Julian Dec 15 '22 at 20:15

0 Answers0