Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] CollectionView crashes on GridItemsLayout Horizontal #13105

Open
davidortinau opened this issue Dec 10, 2020 · 1 comment
Open

[Bug] CollectionView crashes on GridItemsLayout Horizontal #13105

davidortinau opened this issue Dec 10, 2020 · 1 comment
Labels
a/collectionview i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often p/iOS 🍎 t/bug 🐛
Milestone

Comments

@davidortinau
Copy link
Contributor

Description

Vertical orientation works fine, but horizontal crashes both during hot reload, and upon rerun.

Unhandled Exception:
System.ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds
Parameter name: destinationArray
  at System.Array.Copy (System.Array sourceArray, System.Int32 sourceIndex, System.Array destinationArray, System.Int32 destinationIndex, System.Int32 length) [0x000cb] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System/Array.cs:600 
  at System.Array.CopyTo (System.Array array, System.Int32 index) [0x00017] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corert/src/System.Private.CoreLib/src/System/Array.cs:144 
  at Xamarin.Forms.Platform.iOS.GridViewLayout.LayoutAttributesForElementsInRect (CoreGraphics.CGRect rect) [0x000c6] in D:\agent\1\s\Xamarin.Forms.Platform.iOS\CollectionView\GridViewLayout.cs:134 
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],
<CollectionView
            Margin="15"
            x:Name="LayoutsCV"
            ItemsSource="{Binding XamarinAll}"
            IsGrouped="True" 
            SelectionMode="None">
            <CollectionView.ItemsLayout>
                <GridItemsLayout
                    Span="4"
                    HorizontalItemSpacing="10"
                    VerticalItemSpacing="10"
                    Orientation="Horizontal" />
            </CollectionView.ItemsLayout>
            <CollectionView.ItemTemplate>
                <DataTemplate>
                    <Frame
                        HorizontalOptions="Center"
                        HeightRequest="60"
                        WidthRequest="220"
                        Padding="8"
                        CornerRadius="3"
                        BackgroundColor="White"
                        BorderColor="{Binding GroupIndex,
                        Converter={StaticResource IndexToColorConverter},
                        ConverterParameter='ThemePrimary;ThemeSecondary;NeutralTertiary'}"
                        Visual="Material">
                        <Grid ColumnDefinitions="64,*">
                            <Image Source="{Binding Icon}"
                                   HeightRequest="32"
                                   WidthRequest="32"
                                   VerticalOptions="Center"
                                   HorizontalOptions="Center"
                                   />
                            <Label
                                Grid.Column="1"
                                InputTransparent="true"
                                FontSize="14"
                                TextColor="{AppThemeBinding 
                                    Dark={StaticResource TextPrimaryColor_Dark},
                                    Light={StaticResource TextPrimaryColor_Light}}"
                                LineBreakMode="NoWrap"
                                VerticalOptions="Center"
                                Text="{Binding Title}"
                                d:Text="Something Else" />
                        </Grid>
                        <Frame.GestureRecognizers>
                            <TapGestureRecognizer
                                Command="{Binding SelectCommand,Source={RelativeSource AncestorType={x:Type local:IndexPageViewModel}}}"
                                CommandParameter="{Binding .}"
                                />
                        </Frame.GestureRecognizers>
                    </Frame>
                </DataTemplate>
            </CollectionView.ItemTemplate>
            <CollectionView.GroupHeaderTemplate>
                <DataTemplate>
                    <Label Text="{Binding Name}"
                           FontSize="18"
                           />
                </DataTemplate>
            </CollectionView.GroupHeaderTemplate>
        </CollectionView>

Basic Information

Environment

https://gist.github.com/davidortinau/75dfcee9bc8281af454ad890fda34de0

Screenshots

Vertical:

Simulator Screen Shot - iPad Pro (9 7-inch) - 2020-12-10 at 13 35 02

Horizontal:

Screen Shot 2020-12-10 at 1 35 28 PM

Reproduction Link

https://github.com/davidortinau/Xappy/blob/main/Xappy/Xappy/Content/ControlGallery/IndexPage.xaml#L30

@davidortinau davidortinau added t/bug 🐛 s/unverified New report that has yet to be verified labels Dec 10, 2020
@samhouts samhouts added this to New in Triage Dec 10, 2020
@PureWeen PureWeen added this to Backlog in CollectionView via automation Dec 11, 2020
@PureWeen PureWeen moved this from New to Ready For Work in Triage Dec 11, 2020
@PureWeen PureWeen removed the s/unverified New report that has yet to be verified label Dec 11, 2020
@hartez hartez removed this from Ready For Work in Triage Dec 13, 2020
@hartez hartez added this to the 5.0.1 milestone Dec 30, 2020
@hartez hartez moved this from Review Backlog to Backlog in CollectionView Feb 6, 2021
@hartez hartez added the i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often label Feb 6, 2021
@GriffinMeyer
Copy link

I'm currently running into this issue. Is there a workaround and/or ETA for when this might be fixed?

@hartez hartez removed their assignment Jul 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/collectionview i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often p/iOS 🍎 t/bug 🐛
Projects
CollectionView
  
Backlog
Development

No branches or pull requests

5 participants