XamarinFormsPinView icon indicating copy to clipboard operation
XamarinFormsPinView copied to clipboard

System.ObjectDisposedException: Cannot access a disposed object

Open shivraj251 opened this issue 4 years ago • 4 comments

Getting this exception in some of the Android devices. FormsPinView(2.1.0-pre1)

Object name: 'Android.Graphics.Paint'. at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in <07754f4cea12486d9464281b313bc550>:0 at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in <07754f4cea12486d9464281b313bc550>:0 at Android.Graphics.Paint.set_Alpha (System.Int32 value) [0x00022] in <61fdc70e3ec6449cbca4b2444bcf1f69>:0 at FormsPinView.Droid.RippleButton+<>c__DisplayClass17_0.<OnTouchEvent>b__0 () [0x0003a] in <49f4c9956baa4d22a04ad433dcdfbd74>:0 at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <61fdc70e3ec6449cbca4b2444bcf1f69>:0 at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <61fdc70e3ec6449cbca4b2444bcf1f69>:0 at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.48(intptr,intptr)

shivraj251 avatar Oct 09 '20 08:10 shivraj251

@shivraj251 did you get around this?

Joebu avatar Jun 09 '21 21:06 Joebu

@Joebu most likely you need to adjust RippleButton class:


public void Dispose(bool isDisposing)
{
    if (isDisposing)
    {
        _handler?.RemoveCallbacksAndMessages(null);
    }
    base.Dispose(isDisposing);
}

lassana avatar Jun 09 '21 21:06 lassana

@Joebu, no i could not get any solution finally I removed the FormsPinView and implement custom layout that is working well.

shivraj251 avatar Jun 10 '21 05:06 shivraj251

@lassana I tried but getting same error.

shivraj251 avatar Jun 10 '21 05:06 shivraj251