I thought this one has been fixed in the latest version, but I can still see the following bug on my client's devices via AppCenter
Currently, this is in Android (iOS is not published yet)
XF: 4.4.0.991265
I have a Collection view that has a footer and header with dynamic ItemTemplate (DataTemplateSelector - three types of items)
I am unable to reproduce it on my device, but I can see a lot of devices have this issue in AppCenter
JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self)
JniPeerMembers+JniInstanceMethods.InvokeVirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters)
ImageView.get_Drawable ()
ImageElementManager.TryUpdateBitmap (Xamarin.Forms.Platform.Android.IImageRendererController rendererController, Android.Widget.ImageView Control, Xamarin.Forms.IImageElement newImage, Xamarin.Forms.IImageElement previous)
ImageElementManager.OnElementChanged (System.Object sender, Xamarin.Forms.Platform.Android.VisualElementChangedEventArgs e)
AsyncMethodBuilderCore+<>c.b__7_0 (System.Object state)
SyncContext+<>c__DisplayClass2_0.b__0 ()
Thread+RunnableImplementor.Run ()
IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this)
(wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.42(intptr,intptr)
@moustafashaban Can you please attach a small project that demonstrates this issue? Which devices are showing this issue? Thanks!
@samhouts thanks for replying,
as I mentioned in the description, I am unable to reproduce it on my device, it is coming from my clients' devices, the stack trace above coming from the AppCenter
@moustafashaban Sometimes AppCenter reports which devices were affected. That information is helpful. The stack trace is also helpful, but it does not narrow down the root cause. If you can create a small project that mimics the code you have in production (i.e., show what sort of ImageSource you're using, what layouts you've used, etc.), that might help us reproduce the issue. Thanks!
This should get fixed by
https://github.com/xamarin/Xamarin.Forms/pull/9034
Hello @PureWeen and @samhouts . I am experiencing the same issue as @moustafashaban . For me this occur specifically when loading my main AppShell after a login. The page consists of a collectionview with a static list of elements for its ItemsSource. These elements have an ImageSource bound to them which is used in the custom ItemTemplate. The ImageSource objects are contained within a Resources.drawable folder with the build action set to AndroidResource.
System.ObjectDisposedException: 'Cannot access a disposed object.
Object name: 'Xamarin.Forms.Platform.Android.FastRenderers.ImageRenderer'.'
The page does not throw the above mentioned exception all the time, but rather sporadically when logging in. There is no stacktrace provided in VisualStudios 2019, however I did retrieve this stacktrace from AppCenter. This error is occurring on Android OS 8.0, 8.1, 9.0 and 10.0 as of this morning.
JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self)
JniPeerMembers+JniInstanceMethods.InvokeVirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters)
ImageView.get_Drawable ()
ImageElementManager.TryUpdateBitmap (Xamarin.Forms.Platform.Android.IImageRendererController rendererController, Android.Widget.ImageView Control, Xamarin.Forms.IImageElement newImage, Xamarin.Forms.IImageElement previous) D:\a\1\s\Xamarin.Forms.Platform.Android\FastRenderers\ImageElementManager.cs:139
ImageElementManager.OnElementChanged (System.Object sender, Xamarin.Forms.Platform.Android.VisualElementChangedEventArgs e) D:\a\1\s\Xamarin.Forms.Platform.Android\FastRenderers\ImageElementManager.cs:54
AsyncMethodBuilderCore+<>c.
SyncContext+<>c__DisplayClass2_0.
Thread+RunnableImplementor.Run ()
IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this)
(wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.53(intptr,intptr)
Please note for any users that might be looking for a workaround - I was able to continue working as normal by downgrading my Xamarin.Forms from v4.4.0.991265 to v4.3.0.991211.
The fixed has been merged into 4.4 which should be released soon
Great news PureWeen. Thanks for the fast reply.
closed by #9034