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

Cannot access a disposed object

Hello everybody,
after updating Syncfusion nuget packages to version I get the following exception when navigating to another page from a page with a SfDataForm control:

Unhandled Exception:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Syncfusion.XForms.Android.DataForm.SfDataFormViewRenderer'

How can I investigate more this issue?

3 Replies

JN Jayaleshwari N Syncfusion Team January 10, 2019 07:04 AM

Hi Matteo,  
Thanks for contacting Syncfusion Support. 
We have checked the reported query “Exception occurs when navigating to another page from a page with a SfDataForm control in Xamarin Forms” from our side. Unfortunately the reported issue does not reproduce form our end.  
We have prepared and attached the simple sample like navigating to another page from SfDataForm control page for your reference and you can download the same from the following location along with Video. 
Sample link: SfDataForm-Sample 
Video: DataForm_Video 
Could you please check with the provided sample and revert us whether the issue is reproduced? Else, kindly modify the provided sample with replication procedure along with more details regarding your query, editors used in your project,Xamarin forms platform used. So that it will be helpful for us to analyze and provide you possible solution.  
Jayaleshwari N. 

MC Matteo Comi January 11, 2019 01:02 PM

thanks for your feedback.
I tried your sample and it works. I tried to update the sample with part of my code and it works.

The SfDataForm is used to create a login form and send data to a web api to perform the login action. If I remove from my code this call the application works and it navigates to the other page.
The "strange" thing is that the method performing the web action doesn't use SfDataForm at all nor its DataObject nor anything else. The other strange thing is that the same method is called to check the status of the login when the app is reopened, and in this scenario no exceptions are thrown.

With the previous versione of the control I hadn't any problem. Maybe this stacktrace is helpful?

01-11 19:01:19.305 I/MonoDroid(13521): System.ObjectDisposedException: Cannot access a disposed object.
01-11 19:01:19.305 I/MonoDroid(13521): Object name: 'Syncfusion.XForms.Android.DataForm.SfDataFormViewRenderer'.
01-11 19:01:19.305 I/MonoDroid(13521):   at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in <8acc8089c2ed40d08469fbaa6710a44c>:0
01-11 19:01:19.305 I/MonoDroid(13521):   at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualInt32Method (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in <8acc8089c2ed40d08469fbaa6710a44c>:0
01-11 19:01:19.305 I/MonoDroid(13521):   at Android.Views.View.get_Visibility () [0x0000a] in <6f8818d6ffa14f4bad6fb5f5d0f0e665>:0
01-11 19:01:19.305 I/MonoDroid(13521):   at Xamarin.Forms.Platform.Android.VisualElementTracker.UpdateIsVisible () [0x00017] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementTracker.cs:325
01-11 19:01:19.305 I/MonoDroid(13521):   at Xamarin.Forms.Platform.Android.VisualElementTracker.HandlePropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00347] in D:\a\1\s\Xamarin.Forms.Platform.Android\VisualElementTracker.cs:167
01-11 19:01:19.305 I/MonoDroid(13521):   at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs)
01-11 19:01:19.305 I/MonoDroid(13521):   at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:150
01-11 19:01:19.305 I/MonoDroid(13521):   at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:370
01-11 19:01:19.305 I/MonoDroid(13521):   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) [0x00114] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:623
01-11 19:01:19.305 I/MonoDroid(13521):   at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:417
01-11 19:01:19.305 I/MonoDroid(13521):   at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x00225] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:173
01-11 19:01:19.305 I/MonoDroid(13521):   at Xamarin.Forms.BindingExpression.Apply (System.Boolean fromTarget) [0x0003e] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:57
01-11 19:01:19.305 I/MonoDroid(13521):   at Xamarin.Forms.BindingExpression+BindingExpressionPart.<PropertyChanged>b__49_0 () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:615
01-11 19:01:19.305 I/MonoDroid(13521):   at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <6f8818d6ffa14f4bad6fb5f5d0f0e665>:0
01-11 19:01:19.305 I/MonoDroid(13521):   at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <6f8818d6ffa14f4bad6fb5f5d0f0e665>:0
01-11 19:01:19.305 I/MonoDroid(13521):   at (wrapper dynamic-method) System.Object.33(intptr,intptr)

SP Subburaj Pandian Veluchamy Syncfusion Team January 14, 2019 07:07 AM

Hi Matteo,  
Thank you for the update. 
We have checked with the provided information, we are unable to reproduce the issue from our side. We would like to have web meeting to analyze and provide you the solution. So, we have created a new incident under your account. Please log on to our support website to check for further updates regarding the same.   
Subburaj Pandian V  

Live Chat Icon For mobile
Up arrow icon