Pending Review
Last Updated: 18 Jul 2019 16:47 by ADMIN

Hi,

I rolled my app with the ListView out to production and are getting 8+ crashes a day from 140 users with the above issue. I have included a stack trace. I cannot find the steps to reproduce the issue in development. I have rolled back to using the native ListView as this does not crash the app.

Attached is an example project to see what I am doing in general terms, but I have not been able to reproduce this crash in it.

My guess is that a DataTemplate is not being cleaned up properly and when the data behind is changed it attempts to access the control that represented the data in the DataTemplate.

Regards
Anthony

Xamarin caused by: android.runtime.JavaProxyThrowable: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Android.Support.V7.Widget.SwitchCompat'.
Java.Interop.JniPeerMembers.AssertSelf(IJavaPeerable self)<9cb01525c8ce48268eb7a54e1b653d67>:0
Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualVoidMethod(string encodedMember, IJavaPeerable self, JniArgumentValue* parameters)<9cb01525c8ce48268eb7a54e1b653d67>:0
Android.Widget.CompoundButton.set_Checked(bool value)<83e36ed05052486983583851de96589e>:0
Xamarin.Forms.Platform.Android.AppCompat.SwitchRenderer.HandleToggled(object sender, EventArgs e)<e6fe81c4055a4db5bd435b7d12d894e3>:0
at Xamarin.Forms.Switch+<>c.<.cctor>b__14_0 (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x0001c] in <209f66ed8fe04cb6a815feb8c3b62471>:0
Xamarin.Forms.BindableObject.SetValueActual(BindableProperty property, BindableObject.BindablePropertyContext context, object value, bool currentlyApplying, SetValueFlags attributes, bool silent)<209f66ed8fe04cb6a815feb8c3b62471>:0
Xamarin.Forms.BindableObject.SetValueCore(BindableProperty property, object value, SetValueFlags attributes, BindableObject.SetValuePrivateFlags privateAttributes)<209f66ed8fe04cb6a815feb8c3b62471>:0
Xamarin.Forms.BindingExpression.ApplyCore(object sourceObject, BindableObject target, BindableProperty property, bool fromTarget)<209f66ed8fe04cb6a815feb8c3b62471>:0
Xamarin.Forms.BindingExpression.Apply(bool fromTarget)<209f66ed8fe04cb6a815feb8c3b62471>:0
Xamarin.Forms.BindingExpression.BindingExpressionPart.<PropertyChanged>b__49_0()<209f66ed8fe04cb6a815feb8c3b62471>:0
Java.Lang.Thread.RunnableImplementor.Run()<83e36ed05052486983583851de96589e>:0
Java.Lang.IRunnableInvoker.n_Run(IntPtr jnienv, IntPtr native__this)<83e36ed05052486983583851de96589e>:0
at (wrapper dynamic-method) System.Object.31(intptr,intptr)
mono.java.lang.RunnableImplementor.n_run(Native Method)
mono.java.lang.RunnableImplementor.run()RunnableImplementor.java:30
android.os.Handler.handleCallback()Handler.java:739
android.os.Handler.dispatchMessage()Handler.java:95
android.os.Looper.loop()Looper.java:145
android.app.ActivityThread.main()ActivityThread.java:6914
java.lang.reflect.Method.invoke(Native Method)
java.lang.reflect.Method.invoke()Method.java:372
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run()ZygoteInit.java:1404
com.android.internal.os.ZygoteInit.main()ZygoteInit.java:1199