Updating listview crashes

1 Answer 52 Views
ListView (obsolete)
Rafael
Top achievements
Rank 1
Iron
Iron
Rafael asked on 26 Nov 2024, 04:48 PM
When im trying to load information to a list view in my page sometimes this crashes and this is the error that i gave, trying with the native listview the error doesn't happen

Error:

{ObjCRuntime.ObjCException: Objective-C exception thrown.  Name: NSInternalInconsistencyException Reason: Invalid batch updates detected: the number of sections and/or items returned by the data source before and after performing the batch updates are inconsistent with the updates.

Data source before updates = { 3 sections with item counts: [30, 6, 2] }

Data source after updates = { 3 sections with item counts: [30, 6, 2] }

Updates = [

Insert item (0 - 15),

Insert item (0 - 16),

Insert item (0 - 17),

Insert item (0 - 18),

Insert item (0 - 19),

Insert item (0 - 20),

Insert item (0 - 21),

Insert item (0 - 22),

Insert item (0 - 23),

Insert item (0 - 24),

Insert item (0 - 25),

Insert item (0 - 26),

Insert item (0 - 27),

Insert item (0 - 28),

Insert item (0 - 29),

Insert item (1 - 3),

Insert item (1 - 4),

Insert item (1 - 5),

Insert item (2 - 1)

]

Collection view: <TKCollectionView: 0x1237b3200; baseClass = UICollectionView; frame = (0 0; 350 400); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x600000d933c0>; backgroundColor = UIExtendedGrayColorSpace 0 0; layer = <CALayer: 0x60000435c160>; contentOffset: {0, 0}; contentSize: {350, 1365.6666666666667}; adjustedContentInset: {0, 0, 0, 0}; layout: <TKListViewLinearLayout: 0x1329186b0>; dataSource: <Telerik_Maui_Controls_Compatibility_DataControlsRenderer_iOS_TKExtendedListView: 0x123e59480; frame = (0 0; 350 400); hidden = YES; backgroundColor = UIExtendedSRGBColorSpace 1 1 1 1; layer = <CALayer: 0x60000435c420>>>

Native stack trace:

0   CoreFoundation                      0x00000001804b70ec __exceptionPreprocess + 172

1   libobjc.A.dylib                     0x000000018008ede8 objc_exception_throw + 72

2   Foundation                          0x0000000180e73aa8 _userInfoForFileAndLine + 0

3   UIKitCore                           0x00000001851c27a8 -[UICollectionView _Bug_Detected_In_Client_Of_UICollectionView_Invalid_Batch_Updates:] + 92

4   UIKitCore                           0x00000001851c2118 -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:collectionViewAnimator:] + 10296

5   UIKitCore                           0x00000001851beb18 -[UICollectionView _updateRowsAtIndexPaths:updateAction:updates:] + 448

6   UIKitCore                           0x00000001851bec74 -[UICollectionView insertItemsAtIndexPaths:] + 52

7   InbrosApp                           0x000000010432733c -[TKCollectionView insertItemsAtIndexPaths:] + 124

8   InbrosApp                           0x0000000104318dcc __38-[TKListView insertItemsAtIndexPaths:]_block_invoke + 68

9   UIKitCore                           0x0000000186012478 +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 496

10  UIKitCore                           0x0000000186012a70 +[UIView(UIViewAnimationWithBlocks) animateWithDuration:animations:] + 48

11  InbrosApp                           0x0000000104318d14 -[TKListView insertItemsAtIndexPaths:] + 308

12  libxamarin-dotnet-debug.dylib       0x00000001053f4c9c xamarin_dyn_objc_msgSendSuper + 164

13  libmonosgen-2.0.dylib               0x0000000105bf4abc do_icall + 200

14  libmonosgen-2.0.dylib               0x0000000105bf33d0 do_icall_wrapper + 356

15  libmonosgen-2.0.dylib               0x0000000105be7e20 mono_interp_exec_method + 2836

16  libmonosgen-2.0.dylib               0x0000000105be5088 interp_entry_from_trampoline + 548

17  InbrosApp                           0x0000000104345a18 native_to_interp_trampoline + 104

18  libdispatch.dylib                   0x0000000180178de0 _dispatch_client_callout + 16

19  libdispatch.dylib                   0x0000000180187c60 _dispatch_main_queue_drain + 1272

20  libdispatch.dylib                   0x0000000180187758 _dispatch_main_queue_callback_4CF + 40

21  CoreFoundation                      0x000000018041ae3c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12

22  CoreFoundation                      0x0000000180415534 __CFRunLoopRun + 1944

23  CoreFoundation                      0x0000000180414960 CFRunLoopRunSpecific + 536

24  GraphicsServices                    0x0000000190183b10 GSEventRunModal + 160

25  UIKitCore                           0x0000000185aa2b40 -[UIApplication _run] + 796

26  UIKitCore                           0x0000000185aa6d38 UIApplicationMain + 124

27  libxamarin-dotnet-debug.dylib       0x00000001053aff00 xamarin_UIApplicationMain + 60

28  libmonosgen-2.0.dylib               0x0000000105bf4b30 do_icall + 316

29  libmonosgen-2.0.dylib               0x0000000105bf33d0 do_icall_wrapper + 356

30  libmonosgen-2.0.dylib               0x0000000105be7e20 mono_interp_exec_method + 2836

31  libmonosgen-2.0.dylib               0x0000000105be59c0 interp_runtime_invoke + 244

32  libmonosgen-2.0.dylib               0x0000000105afec64 mono_jit_runtime_invoke + 1116

33  libmonosgen-2.0.dylib               0x0000000105cb9d10 mono_runtime_invoke_checked + 148

34  libmonosgen-2.0.dylib               0x0000000105cc12f0 mono_runtime_exec_main_checked + 116

35  libmonosgen-2.0.dylib               0x0000000105b52eec mono_jit_exec + 364

36  libxamarin-dotnet-debug.dylib       0x00000001053f3b00 xamarin_main + 2320

37  InbrosApp                           0x000000010435d0c0 main + 72

38  dyld                                0x0000000104771410 start_sim + 20

39  ???                                 0x00000001044b2274 0x0 + 4367000180

 

   at TelerikUI.TKListView.InsertItems(NSIndexPath[] indexPaths)

   at Telerik.Maui.Controls.Compatibility.DataControlsRenderer.iOS.ListViewBatchUpdates.ApplyChanges()

   at Telerik.Maui.Controls.Compatibility.DataControlsRenderer.iOS.TKExtendedListView.<ScheduleBatchUpdates>b__44_0()

   at Microsoft.Maui.Dispatching.Dispatcher.<>c__DisplayClass10_0.<DispatchDelayedImplementation>b__0()

   at CoreFoundation.DispatchQueue.static_dispatcher_to_managed(IntPtr context) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/CoreFoundation/Dispatch.cs:line 379

   at UIKit.UIApplication.UIApplicationMain(Int32 , String[] , IntPtr , IntPtr ) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 58

   at UIKit.UIApplication.Main(String[] , Type , Type ) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 94

   at InbrosApp.Program.Main(String[] args) in /Users/carminamoreno/Documents/GitHub/Inbros/InbrosApp/Platforms/iOS/Program.cs:line 13

Native stack trace:

0   CoreFoundation                      0x00000001804b70ec __exceptionPreprocess + 172

1   libobjc.A.dylib                     0x000000018008ede8 objc_exception_throw + 72

2   Foundation                          0x0000000180e73aa8 _userInfoForFileAndLine + 0

3   UIKitCore                           0x00000001851c27a8 -[UICollectionView _Bug_Detected_In_Client_Of_UICollectionView_Invalid_Batch_Updates:] + 92

4   UIKitCore                           0x00000001851c2118 -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:collectionViewAnimator:] + 10296

5   UIKitCore                           0x00000001851beb18 -[UICollectionView _updateRowsAtIndexPaths:updateAction:updates:] + 448

6   UIKitCore                           0x00000001851bec74 -[UICollectionView insertItemsAtIndexPaths:] + 52

7   InbrosApp                           0x000000010432733c -[TKCollectionView insertItemsAtIndexPaths:] + 124

8   InbrosApp                           0x0000000104318dcc __38-[TKListView insertItemsAtIndexPaths:]_block_invoke + 68

9   UIKitCore                           0x0000000186012478 +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 496

10  UIKitCore                           0x0000000186012a70 +[UIView(UIViewAnimationWithBlocks) animateWithDuration:animations:] + 48

11  InbrosApp                           0x0000000104318d14 -[TKListView insertItemsAtIndexPaths:] + 308

12  libxamarin-dotnet-debug.dylib       0x00000001053f4c9c xamarin_dyn_objc_msgSendSuper + 164

13  libmonosgen-2.0.dylib               0x0000000105bf4abc do_icall + 200

14  libmonosgen-2.0.dylib               0x0000000105bf33d0 do_icall_wrapper + 356

15  libmonosgen-2.0.dylib               0x0000000105be7e20 mono_interp_exec_method + 2836

16  libmonosgen-2.0.dylib               0x0000000105be5088 interp_entry_from_trampoline + 548

17  InbrosApp                           0x0000000104345a18 native_to_interp_trampoline + 104

18  libdispatch.dylib                   0x0000000180178de0 _dispatch_client_callout + 16

19  libdispatch.dylib                   0x0000000180187c60 _dispatch_main_queue_drain + 1272

20  libdispatch.dylib                   0x0000000180187758 _dispatch_main_queue_callback_4CF + 40

21  CoreFoundation                      0x000000018041ae3c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12

22  CoreFoundation                      0x0000000180415534 __CFRunLoopRun + 1944

23  CoreFoundation                      0x0000000180414960 CFRunLoopRunSpecific + 536

24  GraphicsServices                    0x0000000190183b10 GSEventRunModal + 160

25  UIKitCore                           0x0000000185aa2b40 -[UIApplication _run] + 796

26  UIKitCore                           0x0000000185aa6d38 UIApplicationMain + 124

27  libxamarin-dotnet-debug.dylib       0x00000001053aff00 xamarin_UIApplicationMain + 60

28  libmonosgen-2.0.dylib               0x0000000105bf4b30 do_icall + 316

29  libmonosgen-2.0.dylib               0x0000000105bf33d0 do_icall_wrapper + 356

30  libmonosgen-2.0.dylib               0x0000000105be7e20 mono_interp_exec_method + 2836

31  libmonosgen-2.0.dylib               0x0000000105be59c0 interp_runtime_invoke + 244

32  libmonosgen-2.0.dylib               0x0000000105afec64 mono_jit_runtime_invoke + 1116

33  libmonosgen-2.0.dylib               0x0000000105cb9d10 mono_runtime_invoke_checked + 148

34  libmonosgen-2.0.dylib               0x0000000105cc12f0 mono_runtime_exec_main_checked + 116

35  libmonosgen-2.0.dylib               0x0000000105b52eec mono_jit_exec + 364

36  libxamarin-dotnet-debug.dylib       0x00000001053f3b00 xamarin_main + 2320

37  InbrosApp                           0x000000010435d0c0 main + 72

38  dyld                                0x0000000104771410 start_sim + 20

39  ???                                 0x00000001044b2274 0x0 + 4367000180

}




1 Answer, 1 is accepted

Sort by
0
Didi
Telerik team
answered on 26 Nov 2024, 05:02 PM

Hi,

The RadListView control is obsolete, please use the Telerik MAUI RadCollectionView

The RadCollectionView is a complete rewrite of the ListView from the ground up. CollectionView offers improved performance, enhanced features, and a modernized approach to managing lists of data. The CollectionView incorporates all key features of the ListView.

How to migrate to the new RadCollectionView, review the following article: https://docs.telerik.com/devtools/maui/controls/collectionview/listview-migration 

Regards,
Didi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Rafael
Top achievements
Rank 1
Iron
Iron
commented on 26 Nov 2024, 06:21 PM

Hi i't trying but it doesn't display anything this is my xaml, i load my info asynchronously, i don't know what im doing wrong:
<telerik:RadCollectionView x:Name="siniestroscerradoslistview"
ItemsSource="{Binding SiniestrosCerradosModel}"
Margin="0,10,0,0"
WidthRequest="350"
VerticalOptions="Start"
MinimumHeightRequest="400"
MaximumHeightRequest="400"
HeightRequest="400"
BackgroundColor="Blue"
IsLoadOnDemandActive="{Binding IsLoading}"
IsVisible="True"
>
<telerik:RadCollectionView.EmptyContentTemplate>
<DataTemplate>
<Label Text="No hay siniestros cerrados" />
</DataTemplate>
</telerik:RadCollectionView.EmptyContentTemplate>
<telerik:RadCollectionView.ItemTemplate>
<DataTemplate x:DataType="model:SiniestroModel">
<StackLayout Orientation="Vertical"
Margin="15,0,0,5"
HeightRequest="100"
MaximumHeightRequest="100"
MinimumHeightRequest="100"
BackgroundColor="White">
<Label FontAutoScalingEnabled="False" BackgroundColor="White">
<Label.FormattedText>
<FormattedString>
<Span FontAutoScalingEnabled="False" Text="{Binding Poliza , StringFormat='Póliza: {0}'}"
FontFamily="SFProTextBold" FontSize="14" TextColor="Black" />
<Span FontAutoScalingEnabled="False" Text="{Binding TipoSiniestro, StringFormat='&#x0a;{0}'}"
FontFamily="SFProTextRegular" FontSize="12" TextColor="Black" />
<Span FontAutoScalingEnabled="False" Text="{Binding Ubicacion, StringFormat='&#x0a;{0}'}"
FontFamily="SFProTextRegular" FontSize="12" TextColor="{StaticResource Gray100}" />
</FormattedString>
</Label.FormattedText>
</Label>
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:SiniestrosViewModel}}, Path= GoToDetailsCommand }"
CommandParameter="{Binding .}"
/>
</StackLayout.GestureRecognizers>
</StackLayout>
</DataTemplate>
</telerik:RadCollectionView.ItemTemplate>
<!-- <telerik:RadCollectionView.GroupDescriptors>
<telerik:PropertyGroupDescriptor PropertyName="Ramo"/>
</telerik:RadCollectionView.GroupDescriptors> -->
<telerik:RadCollectionView.FooterTemplate>
<DataTemplate>
<StackLayout Orientation="Vertical"
BackgroundColor="Transparent"
Margin="{OnPlatform iOS='0,0,0,0'}"
HeightRequest="{OnPlatform Android='400', iOS='250'}" >
</StackLayout>
</DataTemplate>
</telerik:RadCollectionView.FooterTemplate>
</telerik:RadCollectionView>
Rafael
Top achievements
Rank 1
Iron
Iron
commented on 26 Nov 2024, 06:22 PM

Removed the group descriptor for testing but doesn't load anything
Didi
Telerik team
commented on 27 Nov 2024, 07:15 AM

I have checked the attached code and the IsLoadOnDemandEnabled set to true was skipped. I have used the approaches described here: https://docs.telerik.com/devtools/maui/controls/collectionview/load-on-demand/overview and the data loads on demand. Please set the IsLoadOnDemandEnabled="True", to enable the load on demand functionality.

Also I can suggest you replaced the StackLayout with - VerticalStackLayout. 

Tags
ListView (obsolete)
Asked by
Rafael
Top achievements
Rank 1
Iron
Iron
Answers by
Didi
Telerik team
Share this question
or