NullReference when setting the page's BindingContext to Null

Hello,

In our app, whenever we close a page to go back to the previous one, just before closing it, we set the page's BindingContext to Null to cleanup some other stuff in our app. It usually isn't a problem with your grid, but on one of our pages, a NullReference happened that crashed the app : 

NullReferenceException Object reference not set to an instance of an object    at Syncfusion.SfDataGrid.XForms.SpannedDataRow.Dispose (System.Boolean disposing) <0xc877bca4 + 0x00024> in <31e4d624db2b4decb46fcb05e41f89c5>:0    at Syncfusion.SfDataGrid.XForms.DataRowBase.Dispose () <0xc876b71c + 0x0001f> in <31e4d624db2b4decb46fcb05e41f89c5>:0    at Syncfusion.SfDataGrid.XForms.RowGenerator.OnItemsSourceChanged () <0xc876c6a8 + 0x0009b> in <31e4d624db2b4decb46fcb05e41f89c5>:0    at Syncfusion.SfDataGrid.XForms.SfDataGrid.OnItemsSourceChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) <0xc87465f4 + 0x008f7> in <31e4d624db2b4decb46fcb05e41f89c5>:0    at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) <0xca29f600 + 0x0033f> in <0e83d8ea25694febbc82730d1fc0e5e7>:0    at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) <0xca29ef58 + 0x0057b> in <0e83d8ea25694febbc82730d1fc0e5e7>:0    at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) <0xca29ed50 + 0x000eb> in <0e83d8ea25694febbc82730d1fc0e5e7>:0    at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle) <0xca29ed10 + 0x00037> in <0e83d8ea25694febbc82730d1fc0e5e7>:0    at Xamarin.Forms.Setter.UnApply (Xamarin.Forms.BindableObject target, System.Boolean fromStyle) <0xca357180 + 0x0012f> in <0e83d8ea25694febbc82730d1fc0e5e7>:0 (...)

This crash happened only once, and I cannot reproduce it, but I was hoping you would be able to, at the very least, tell me what could be the cause.

There are 2 things that work differently with this page compared to the rest :
- We use a SfDataPager with OnDemandLoading
- Whenever there is only 1 page, the SfDataPager is hidden, and we use a different Binding for the SfDataGrid.ItemsSource (Basically, using DataTriggers, whenever there are 2 pages, we use SfDataPager.PagedSource as our ItemsSource, but if there is only 1 page, we use a normal Binding on a list)

Preferably, we would rather not change the way this grid works, because that is how our users want it to work.

This issue happened in these conditions :
- Honeywell CT60 on Android 6.0
- SyncFusion v17.3.0.34
- Xamarin.Android.Support v28.0.0.3
- Xamarin.Forms v4.3.0.908675

12 Replies

SS Sivaraman Sivagurunathan Syncfusion Team April 8, 2020 11:24 AM UTC

Hi Maxence, 

Thanks for using Syncfusion controls. 


We have checked the reported issue and prepared the sample based on your requirement, but we are unable to reproduce the issue from our side. We have attached the sample we tested and its screenshots taken in device and emulator for your reference. 


We have suspect that, you have used the older version of SfDataGrid. Can you please update to latest version and ensure the issue. In case, if you are able to reproduce the issue at your side, then please revert us with a modified sample reproducing the issue along with clear replication procedure to proceed further.  

Regards, 
Sivaraman S 



MR Maxence Roberge April 8, 2020 12:55 PM UTC

Hi,

Like I said, it only happened once and I wasn't able to reproduce it. I was mostly looking for what could provoke a NullReference in the SpannedDataRow.Dispose() function so that I can figure out what went wrong that one instance, but if it can help, I can try to reproduce our current environnement in your sample.


SS Sivaraman Sivagurunathan Syncfusion Team April 9, 2020 01:19 PM UTC

Hi Maxence,   
  
We have checked the reported issue with latest source, but we are not able to reproduce the reported issue. But we have  logged the bug reported to check the possible null case in SpannedDataRow Dispose method.The fix for this issue is estimated to be available on 14th April, 2020.   
   
You can track the status of the bug from the below feedback link.   
   
https://www.syncfusion.com/feedback/13334/need-to-add-null-check-in-spanneddatarow-dispose-method 


Regards,   
Sivaraman S  



KK Karthikraja Kalaimani Syncfusion Team April 14, 2020 06:21 AM UTC

Hi Maxence,

Due to network problem from our side, the fix was not included in our weekly nuget release. So, we will include the fix in our upcoming weekly nuget which is scheduled on 21st April 2020. However, if you may want the fix earlier than 21st April, please revert us with your version number so that we can provide patch in your version.

Regards,
Karthik Raja 



MR Maxence Roberge April 14, 2020 12:31 PM UTC

Hi,

It's alright, it can wait until the 21st. Thanks for the help!


KK Karthikraja Kalaimani Syncfusion Team April 15, 2020 09:32 AM UTC

Hi Maxence,

Thanks for the reply.

Regards,
Karthik Raja 



KK Karthikraja Kalaimani Syncfusion Team April 21, 2020 07:29 AM UTC

Hi Maxence, 
  
We are glad to let you know that we have included the fix in our weekly NuGet update version 18.1.0.45 which is available for download (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, 
Karthik Raja 



MR Maxence Roberge April 21, 2020 03:18 PM UTC

Hi, thanks for the update!

I updated my app to the 18.1.0.45 version, but now I have a new problem :

Sometimes, when I scroll, the text in my columns is randomly misaligned. Either it can't takes only a portion of the column's width, or the column has no width and the text appears outside of the column. I can't reproduce it 100% of the time, but it happens pretty often when scrolling horizontally and vertically.

It didn't happen it the version I was using before. Any ideas what could be happening?

This time, it happens on :
- Panasonic FZ-N1 on Android 8.1
- SyncFusion v18.1.0.45
- Xamarin.Android.Support v28.0.0.3
- Xamarin.Forms v4.3.0.908675


KK Karthikraja Kalaimani Syncfusion Team April 22, 2020 11:25 AM UTC

Hi Maxence,

Could you please confirm the below screenshot whether you are facing the same issue?. If not please provide SfDataGrid configuration and Screenshot of this issue.

Screenshot :

 
 

Regards,
Karthik Raja
 



MR Maxence Roberge April 22, 2020 12:35 PM UTC

There's a couple different things that can happen. In your screenshot, the text in the missing doesn't appear, but it can also appear outside the column from time to time.

But yes, what happened in your screenshot seems to be my problem.


KK Karthikraja Kalaimani Syncfusion Team April 23, 2020 12:31 PM UTC

Hi Maxence,

Thanks for the update.

This is already known issue and we have logged bug report for the same. We will fix the issue and include the fix in our upcoming weekly nuget which is scheduled on 5th May 2020. We appreciate your patience until then.


You can also track the status of the report in below feedback link,
https://www.syncfusion.com/feedback/13515/android-grid-cells-getting-messed-up-during-scrolling-in-tab



Regards,
Karthik Raja
 



KK Karthikraja Kalaimani Syncfusion Team May 4, 2020 04:13 AM UTC

Hi Maxence,

We are glad to let you know that we have included the fix in our weekly NuGet update version 18.1.0.46 which is available for download (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. 

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,
Karthik Raja
 


Loader.
Up arrow icon