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. Image for the cookie policy date
close icon

Cannot access a disposed object


I'm trying your SfDataGrid and I'm getting in trouble when I call an async void button click handle than contains an await Task method call. The button handler ends with a FragmentManager.PopBackStack(); but I think there is something lost on disposing grid.

After some other work on the app, the GC is automatically called and I get the following error that shutdown my app:

Unhandled Exception:
06-19 10:31:53.184 E/mono (16264): System.ObjectDisposedException: Cannot access a disposed object.
06-19 10:31:53.184 E/mono (16264): Object name: 'Syncfusion.SfDataGrid.SfDataGrid'.
06-19 10:31:53.184 E/mono (16264): at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00030] in /Users/builder/data/lanes/3511/ce955cc0/source/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.cs:153
06-19 10:31:53.184 E/mono (16264): at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualInt32Method (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00002] in /Users/builder/data/lanes/3511/ce955cc0/source/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:201
06-19 10:31:53.184 E/mono (16264): at Android.Views.ViewGroup.get_ChildCount () [0x00000] in /Users/builder/data/lanes/3511/ce955cc0/source/monodroid/src/Mono.Android/platforms/android-22/src/generated/Android.Views.ViewGroup.cs:1117
06-19 10:31:53.184 E/mono (16264): at Syncfusion.SfDataGrid.SfDataGrid.Dispose (System.Boolean disposing) [0x00000] in <8578f20a05e5450c903cc09f21f2ec6d>:0
06-19 10:31:53.184 E/mono (16264): at Java.Lang.Object.Finalize () [0x00051] in /Users/builder/data/lanes/3511/ce955cc0/source/xamarin-android/src/Mono.Android/Java.Lang/Object.cs:67

Could you provide me some information?
Thank you!

1 Reply

AN Ashok N Syncfusion Team June 20, 2017 10:34 AM UTC

Hi Customer,  
Thanks for contacting Syncfusion support. 
We have tested the reported issue by loading SfDataGrid into Fragment and called FragmentManager.PopBackStack() method in button click event but we are not able to reproduce the reported crash. For your reference we have attached the working copy of our sample in the below link. Could you please do revert us by modifying our sample to replicate the issue. Otherwise please share your sample along with replication procedure, that would be more helpful for us to proceed further.  

Live Chat Icon For mobile
Up arrow icon