The reordering in SfListView in iOS (13.4.1) crash

I have a view with  SfListView and reordering. The reordering works fine for Android and UWP, but in iOS it crash the app. I know, that the same code worked in the previous version. The reason is now in the renderer:


Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
  at Syncfusion.ListView.XForms.iOS.DragIndicatorViewRenderer.get_ListView () [0x00006] in <d717b1a77a7c487f82afa3e535c22fcc>:0 
  at Syncfusion.ListView.XForms.iOS.DragIndicatorViewRenderer.TouchesEnded (Foundation.NSSet touches, UIKit.UIEvent evt) [0x00000] in <d717b1a77a7c487f82afa3e535c22fcc>:0 
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/UIKit/UIApplication.cs:6
  at LightdriveApp.iOS.Application.Main (System.String[] args) [0x00001] in C:\Git\Lightdrive\LightdriveApp\LightdriveApp\LightdriveApp.iOS\Main.cs:17
2020-05-07 21:33:03.619850+0200 LightdriveApp.iOS[6803:162053] Unhandled managed exception: Object reference not set to an instance of an object (System.NullReferenceException)
  at Syncfusion.ListView.XForms.iOS.DragIndicatorViewRenderer.get_ListView () [0x00006] in <d717b1a77a7c487f82afa3e535c22fcc>:0 
  at Syncfusion.ListView.XForms.iOS.DragIndicatorViewRenderer.TouchesEnded (Foundation.NSSet touches, UIKit.UIEvent evt) [0x00000] in <d717b1a77a7c487f82afa3e535c22fcc>:0 
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args, System.String princi
palClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.16.0.13/src/Xamarin.iOS/UIKit/UIApplication.cs:65 
  at LightdriveApp.iOS.Application.Main (System.String[] args) [0x00001] in C:\Git\Lightdrive\LightdriveApp\LightdriveApp\LightdriveApp.iOS\Main.cs:17


8 Replies

LN Lakshmi Natarajan Syncfusion Team May 8, 2020 08:40 AM UTC

Hi Marian, 
 
Thank you for using Syncfusion products. 
 
We have checked the reported query “Crash when Reordering in iOS” from our end. We are unable to reproduce the reported issue in our sample. We have ensured the sample in iOS 13.1 simulator and ItemReordering works fine as expected. We have attached the tested sample in the following link, 
 
 
Please check the sample and let us know if you still facing the same issue? If yes, kindly revert us with the modified sample to reproduce the issue and revert us back with the following details which would be helpful for us to check on it and provide you the solution as soon as possible. 
  • Share ListView related templates
  • Share Syncfusion and Xamarin.Forms version used
  • Share iOS and Mac configuration details
 
Lakshmi Natarajan 
 



MG Marian Grzesik May 11, 2020 11:03 AM UTC

Hi Lakshimi,

thanks for your answer. I've found the problem. The crash happend, because I  tried to update my list after it was reordered. 

public SceneConfiguratorPage()
        {
            InitializeComponent();
            SceneListView.DragDropController.UpdateSource = true;
            SceneListView.ItemDragging += SceneListView_ItemDragging;
        }

        private async void SceneListView_ItemDragging(object sender, Syncfusion.ListView.XForms.ItemDraggingEventArgs e)
        {
            if (e.Action == DragAction.Drop)
            {
                var vm = BindingContext as SceneConfiguratorViewModel;
                if(vm!=null)
                {
                    await Task.Delay(200);
                    vm.MoveSceneCommand.Execute(new MoveListItemParam { OldIndex = e.OldIndex, NewIndex = e.NewIndex });

                }
            }
        }


Now I deleted the code:

SceneListView.ItemDragging += SceneListView_ItemDragging;

I update now the list in the ViewModel after reordering:

Scenes = new ObservableCollection(ZoneScenes[ZoneIndex]);
Scenes.CollectionChanged -= Scenes_CollectionChanged;
Scenes.CollectionChanged += Scenes_CollectionChanged;


private void Scenes_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            for (var index = 0; index < Scenes.Count; index++)
            {
                Scenes[index].SceneNumber = index + 1;
            }
        }



CS Chandrasekar Sampathkumar Syncfusion Team May 11, 2020 11:19 AM UTC

Hi Marian,  
Thank you for the update. 
We are glad that the issue resolves at your end. Please let us know if you need any further assistance. As always we are happy to help you out. 
Regards, 
Chandrasekar Sampathkumar 



MG Marian Grzesik May 11, 2020 11:45 AM UTC

Hi,

I've noticed also, that in a list, where the items can be reordered, the list cannot be changed. It cause also a crash.

Example:
The list updates the source:

public SceneConfiguratorPage()
        {
            InitializeComponent();
            SceneListView.DragDropController.UpdateSource = true;
            //SceneListView.ItemDragging += SceneListView_ItemDragging;
        }

Than reorder an item ( I have 8 items in the list in view model)

Than Clear the list in viewmodel and add the same count of items.

Than reorder the list -> crash. 

It looks like an deleted item in view model is called from the control and therefore it causes a crash. 




MG Marian Grzesik May 11, 2020 12:59 PM UTC

Hi,

I created an example. If you try to reorder the list, the app crash. 

If you delete the line in bold:

public MainPage()
        {
            InitializeComponent();
            BindingContext = new MainPageViewModel();
            SceneListView.DragDropController.UpdateSource = true;
            SceneListView.ItemDragging += SceneListView_ItemDragging;
        }

it works. But the list is not reordered in viewmodel, what I need. Switch also the buttons, to update the list.
I tried it in the simulator iPad Pro iOS 13.4




Attachment: ListReordering_a53f29cc.zip


LN Lakshmi Natarajan Syncfusion Team May 12, 2020 07:01 PM UTC

Hi Marian, 
 
Thank you for the sample. 
 
We have checked the provided sample and we could reproduce the reported issue at our side. We would like to inform you that the reported issue occurred when reordering item with TemplateSelector and also with the UpdateSource enabled for the DragDropController. We are currently validating the reported issue in our source and provide you further details on May 14, 2020. We appreciate your patience until then. 
 
Lakshmi Natarajan 




LN Lakshmi Natarajan Syncfusion Team May 14, 2020 08:46 AM UTC

Hi Marian,    
    
Thank you for your patience. 
   
We have checked the reported issue `Item Reordering issue in iOS` and logged the issue report for the same. We will fix the issue and include the issue fix in upcoming 2020 Volume 2 release which is planned to roll out at the end of July, 2020. We appreciate your patience until then. 
  
You can track the status of this report through the following feedback link, 
  
Note: The provided feedback link is private, you need to login to view this feedback. 
 
However, we have generated the custom patch in version 18.1.0.52, please apply the patch by the following. 
 
Please find the patch setup from below location:   
   
Please find the patch assemblies alone from below location:   
       
Please find the NuGet alone from the below location:     
         
Clear nuget cache by using the following link:      
     
Assembly Version: 18.1.0.52 
         
Please apply this patch and let us know whether the mentioned issue resolved at your end?    
    
Regards,    
Lakshmi Natarajan   
 



LN Lakshmi Natarajan Syncfusion Team June 9, 2020 11:12 AM UTC

Hi Marian, 
 
Thank you for your patience.   
   
We have fixed the reported issue “Item Reordering issue in iOS” and included the issue fix in our latest Weekly NuGet release update version 18.1.0.56 which is available for download (https://www.nuget.org/).   
  
 
We thank you for your support and appreciate your patience in waiting for this update. Please get in touch with us if you would require any further assistance.   
 
Regards, 
Lakshmi Natarajan 


Loader.
Up arrow icon