Unplanned
Last Updated: 22 Aug 2022 20:58 by Brent
Ryan
Created on: 05 Apr 2022 09:50
Category: UI for Xamarin
Type: Bug Report
3
[Android] Telerik.XamarinForms.Common.GestureListener.OnLongPress is called on element that is already disposed

LongPress is called on element that is already disposed. 

ObjectDisposedException is thrown:

at Telerik.XamarinForms.Common.NativeGestureRecognizer.ToDip
 at Telerik.XamarinForms.Common.GestureListener.OnLongPress

Stack-Trace

 

Xamarin Exception Stack: System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Xamarin.Forms.Platform.Android.Platform+DefaultRenderer'. at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in <2e109281f9514c53b44688fd4549adb2>:0 at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeNonvirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in <2e109281f9514c53b44688fd4549adb2>:0 at Android.Views.View.get_Context () [0x0000a] in <9d68875f5dbd432db5314e1c0d96cb02>:0 at Telerik.XamarinForms.Common.NativeGestureRecognizer.ToDip (System.Single px) [0x00000] in <9f139977bc32402dabe4bb05ac247bb2>:0 at Telerik.XamarinForms.Common.GestureListener.OnLongPress (Android.Views.MotionEvent e) [0x0000c] in <9f139977bc32402dabe4bb05ac247bb2>:0 at Android.Views.GestureDetector+IOnGestureListenerInvoker.n_OnLongPress_Landroid_view_MotionEvent_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_e) [0x0000f] in <9d68875f5dbd432db5314e1c0d96cb02>:0 at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.102(intptr,intptr,intptr)

The issue occurs on the following device:

Android: 12
Manufacturer: samsung
Model: SM-G970U
2 comments
Brent
Posted on: 22 Aug 2022 20:58

We're seeing this as well, Android only but with a slightly different callstack:

JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self)
JniPeerMembers+JniInstanceMethods.InvokeNonvirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters)
View.get_Context ()
NativeGestureRecognizer.ToDip (System.Single px)
GestureListener.OnLongPress (Android.Views.MotionEvent e)
GestureDetector+IOnGestureListenerInvoker.n_OnLongPress_Landroid_view_MotionEvent_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_e)
(wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.153(intptr,intptr,intptr)


Ryan
Posted on: 16 May 2022 19:23
Used the new version and still having the same issue. 


Xamarin Exception Stack:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Xamarin.Forms.Platform.Android.Platform+DefaultRenderer'.
at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in <1921523bc22e407fa9a0855bdae29335>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeNonvirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in <1921523bc22e407fa9a0855bdae29335>:0
at Android.Views.View.get_Context () [0x00000] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-30/mcw/Android.Views.View.cs:5794
at Telerik.XamarinForms.Common.NativeGestureRecognizer.ToDip (System.Single px) [0x00012] in <f7498bdcff2341b1872fede79cbc36d3>:0
at Telerik.XamarinForms.Common.GestureListener.OnLongPress (Android.Views.MotionEvent e) [0x0000c] in <f7498bdcff2341b1872fede79cbc36d3>:0
at Android.Views.GestureDetector+IOnGestureListenerInvoker.n_OnLongPress_Landroid_view_MotionEvent_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_e) [0x00010] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-30/mcw/Android.Views.GestureDetector.cs:614
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.108(intptr,intptr,intptr)



Thread 2:
0 dalvik.system.VMStack.getThreadStackTrace(VMStack.java:-2)
1 java.lang.Thread.getStackTrace(Thread.java:1724)
2 java.lang.Thread.getAllStackTraces(Thread.java:1800)
3 com.microsoft.appcenter.crashes.Crashes.saveUncaughtException(Crashes.java:1146)
4 com.microsoft.appcenter.crashes.WrapperSdkExceptionManager.saveWrapperException(WrapperSdkExceptionManager.java:58)
5 crc6408f703899a12549e.GestureListener.n_onLongPress(GestureListener.java:-2)
6 crc6408f703899a12549e.GestureListener.onLongPress(GestureListener.java:55)
7 android.view.GestureDetector.dispatchLongPress(GestureDetector.java:954)
8 android.view.GestureDetector.access$300(GestureDetector.java:69)
9 android.view.GestureDetector$GestureHandler.handleMessage(GestureDetector.java:339)
10 android.os.Handler.dispatchMessage(Handler.java:106)
11 android.os.Looper.loopOnce(Looper.java:226)
12 android.os.Looper.loop(Looper.java:313)
13 android.app.ActivityThread.main(ActivityThread.java:8663)
14 java.lang.reflect.Method.invoke(Method.java:-2)
15 com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
16 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)