We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Syncfusion.GridCommon.ScrollAxis.DistanceRangeCounterCollection.CheckRange ArgumentOutOfRangeException?

Thread ID:

Created:

Updated:

Platform:

Replies:

132593 Sep 11,2017 09:43 AM UTC Sep 13,2017 08:33 AM UTC Xamarin.Forms 3
loading
Tags: SfListView
Emil
Asked On September 11, 2017 09:43 AM UTC

I am getting random crashes in latest version of sfListview. when I debug I cant always reproduce it but in my exception log, i am seeing these crashes which i didnt experience in previous versions. below is how the stack trace looks like. can you give me maybe some hints what could be the problem?

System.ArgumentOutOfRangeException: 0 out of range 0 to -1
09-11 12:10:59.467 I/MonoDroid(31203): Parameter name: from
09-11 12:10:59.467 I/MonoDroid(31203):   at Syncfusion.GridCommon.ScrollAxis.DistanceRangeCounterCollection.CheckRange (System.String paramName, System.Int32 from, System.Int32 to, System.Int32 actualValue) [0x00046] in <73fc3b6e952e4b678eba3c17b0f93ebc>:0 
09-11 12:10:59.467 I/MonoDroid(31203):   at Syncfusion.GridCommon.ScrollAxis.DistanceRangeCounterCollection.SetRange (System.Int32 from, System.Int32 to, System.Double distance) [0x0000d] in <73fc3b6e952e4b678eba3c17b0f93ebc>:0 
09-11 12:10:59.467 I/MonoDroid(31203):   at Syncfusion.GridCommon.ScrollAxis.LineSizeCollection.InitializeDistances () [0x00101] in <73fc3b6e952e4b678eba3c17b0f93ebc>:0 
09-11 12:10:59.467 I/MonoDroid(31203):   at Syncfusion.GridCommon.ScrollAxis.LineSizeCollection.ResumeUpdates () [0x0001e] in <73fc3b6e952e4b678eba3c17b0f93ebc>:0 
09-11 12:10:59.467 I/MonoDroid(31203):   at Syncfusion.ListView.XForms.LinearLayout.EnsureItems (Syncfusion.GridCommon.ScrollAxis.VisibleLinesCollection visibleLines) [0x002ee] in <7c211337e892498cb945b4618da91c6e>:0 
09-11 12:10:59.467 I/MonoDroid(31203):   at Syncfusion.ListView.XForms.VisualContainer.EnsureItems () [0x0002b] in <7c211337e892498cb945b4618da91c6e>:0 
09-11 12:10:59.468 I/MonoDroid(31203):   at Syncfusion.ListView.XForms.VisualContainer.OnSizeAllocated (System.Double width, System.Double height) [0x0003f] in <7c211337e892498cb945b4618da91c6e>:0 
09-11 12:10:59.468 I/MonoDroid(31203):   at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:629 
09-11 12:10:59.468 I/MonoDroid(31203):   at Xamarin.Forms.Layout.ForceLayout () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:108 
09-11 12:10:59.468 I/MonoDroid(31203):   at Syncfusion.ListView.XForms.LinearLayout.OnItemsCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00131] in <7c211337e892498cb945b4618da91c6e>:0 
09-11 12:10:59.468 I/MonoDroid(31203):   at Syncfusion.ListView.XForms.SfListView.DisplayItems_CollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x0000f] in <7c211337e892498cb945b4618da91c6e>:0 
09-11 12:10:59.468 I/MonoDroid(31203):   at Syncfusion.DataSource.DisplayItems.RaiseCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs args) [0x00008] in <2cf2bade62784344bcd000a328c48bb8>:0 
09-11 12:10:59.468 I/MonoDroid(31203):   at Syncfusion.DataSource.GroupList.RemoveItemInGroup (System.Object item) [0x00023] in <2cf2bade62784344bcd000a328c48bb8>:0 
09-11 12:10:59.468 I/MonoDroid(31203):   at Syncfusion.DataSource.DataSource.NotifyPropertyChangedHandler (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x000a0] in <2cf2bade62784344bcd000a328c48bb8>:0 
09-11 12:10:59.468 I/MonoDroid(31203):   at Syncfusion.DataSource.DataSource.OnPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00009] in <2cf2bade62784344bcd000a328c48bb8>:0 

Dinesh Babu Yadav [Syncfusion]
Replied On September 12, 2017 11:35 AM UTC

Hi Emil, 
 
Sorry for the inconvenience caused. 
 
We have already resolved the similar reported issue (according to provided stack trace) at our end in the 2017 Volume 3 main release. So, could you please check with the latest SfListView version (v15.3.0.29) at your end?. If the issue still persists, then please share the below details which would help us to analyze the issue better and update you an appropriate solution. 
 
  • Have you used StickyGroupHeader or StickyHeader and changing the property value at runtime?
  • Whether the issue occurs only in specific platform like only in Android platform or in others too?
  • Please share the SfListView version in which the issue replicated?
  • Have you performed any specific operations at your application? For example: changing the property value in the data model at runtime by which underlying data will move to another group.
 
Please let us know if you require further assistance. 
 
Regards, 
Dinesh Babu Yadav 
 


Emil
Replied On September 12, 2017 09:25 PM UTC

I am already using this version and experiencing errors time to time. please see my sflistview below. i am executing property change from viewmodel using mvvm and at the same time, it changes selecteditem and should programmaticly scroll to selecteditem. here there can be problem my assumption. see my scrolling implementation. if scrolling fails and i raise property changed when item is not on the screen. I am not sure if this is possible. although I tried to reproduce this case but it didnt happen in my d



      <sfListView:SfListView x:Name="listItems" IsStickyFooter="True"  ItemsSource="{Binding Items}" SelectionMode="Single"  SelectionGesture="Tap" 

             ItemSpacing="2" AllowSwiping="False"  PropertyChanged="listItems_PropertyChanged"  SelectionBackgroundColor="Yellow"  Orientation="Horizontal"  VerticalOptions="FillAndExpand"

             SelectedItem="{Binding CurrentItem, Mode=TwoWay}" ItemHolding="listItems_ItemHolding"  HorizontalOptions="FillAndExpand" 

                               ItemDoubleTapped="listItems_ItemDoubleTapped" >

                <sfListView:SfListView.LayoutManager>

                    <sfListView:LinearLayout />

                </sfListView:SfListView.LayoutManager>               

                <sfListView:SfListView.FooterTemplate>

                <DataTemplate>

                    <Grid BackgroundColor="White">              

                        <controls:ImageButton Source="addFAB.png" x:Name="btnAddSet"  VerticalOptions="Center"

                                    Command="{Binding Path=BindingContext.AddItemClick, Source={x:Reference Name=cwItemsHorizontal}}"   HorizontalOptions="Center"                                      

                                        />

                    </Grid>

                </DataTemplate>

            </sfListView:SfListView.FooterTemplate>

                <sfListView:SfListView.DataSource>

                    <data:DataSource>

                        <data:DataSource.GroupDescriptors>

                            <data:GroupDescriptor PropertyName="DisplayOrder" />

                        </data:DataSource.GroupDescriptors>

                    </data:DataSource>

                </sfListView:SfListView.DataSource>

                <sfListView:SfListView.GroupHeaderTemplate>

                    <DataTemplate>

                        <ViewCell>

                            <ViewCell.View>

                             

<AbsoluteLayout InputTransparent="True"  WidthRequest="30"  Grid.Row="0" Grid.Column="0"    HorizontalOptions="Center" VerticalOptions="Start" >

                                    <BoxView StyleClass="Circle" BackgroundColor="#ADD8E6"  HorizontalOptions="Center" VerticalOptions="Center"

AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds=".5,.5,1,1" />


                                    <Label BackgroundColor="Transparent"  HorizontalOptions="Center" VerticalOptions="Center"  Text="{Binding Key}"   StyleClass="Body"

AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds=".5,.5,1,1" />


                                </AbsoluteLayout>                           

                            </ViewCell.View>

                        </ViewCell>

                    </DataTemplate>

                </sfListView:SfListView.GroupHeaderTemplate>

                <sfListView:SfListView.ItemSize>

                    <OnPlatform x:TypeArguments="x:Double">

                        <OnPlatform.Android>

                            <OnIdiom x:TypeArguments="x:Double" Phone="100" Tablet="150" />

                        </OnPlatform.Android>

                        <OnPlatform.iOS>

                            <OnIdiom x:TypeArguments="x:Double" Phone="100" Tablet="150" />

                        </OnPlatform.iOS>

                        <OnPlatform.WinPhone>

                            <OnIdiom x:TypeArguments="x:Double" Phone="100" Tablet="200" Desktop="250" />

                        </OnPlatform.WinPhone>

                    </OnPlatform>

                </sfListView:SfListView.ItemSize>

                <sfListView:SfListView.ItemTemplate>

                    <DataTemplate>

                        <AbsoluteLayout  InputTransparent="True" >

 

                        </AbsoluteLayout>

                    </DataTemplate>

                </sfListView:SfListView.ItemTemplate>

            </sfListView:SfListView>

  private void listItems_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)

        {

            if (e.PropertyName == "SelectedItem")

            {

                try

                {

                    if (vm == null)

                        vm = (BaseItemsPageModel)this.BindingContext;

                    int ScrollIndex= vm.CurrentItem != null ? vm.Items.IndexOf(vm.CurrentItem) : 1;

                    (listItems.LayoutManager as Syncfusion.ListView.XForms.LinearLayout).ScrollToRowIndex(ScrollIndex);

                }

                catch (Exception ex)

                {

                    

                }

            }

        }


Dinesh Babu Yadav [Syncfusion]
Replied On September 13, 2017 08:33 AM UTC

Hi Emil, 
 
Sorry for the inconvenience. 
 
Based on the given code snippet and information’s, we have tried to reproduce the reported issue with our sample. In the sample, we have used similar code snippet as provided and changed the CurrentItem (property in View Model) value in a button click event which scroll to selected item in the PropertyChanged event using ScrollToRowIndex method. Unfortunately, we are unable to reproduce the issue at our end. For your reference, we have attached the ensured sample at our end and you can download it from the below link. 
 
 
But according to the given stack trace, we suspect that the issue may occur when a property in underlying data is changed at runtime by which the data moves from one group to another group like similar scenario.  
 
So, could you please share that have you performed any similar scenario like above in your application? If yes, please share the details of that with code examples and if possible, please modify the above sample like your application scenario which would help us to replicate the issue at our end and update you an appropriate solution. 
 
Please let us know if you require further assistance. 
 
Regards, 
Dinesh Babu Yadav 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;