首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ObjectDisposedException in CarouselViewRenderer

ObjectDisposedException in CarouselViewRenderer
EN

Stack Overflow用户
提问于 2022-07-07 12:46:34
回答 1查看 115关注 0票数 0

有时,我们的应用程序会崩溃,但有以下例外:

System.ObjectDisposedException:无法访问已释放的对象。对象名称:'Xamarin.Forms.Platform.Android.CarouselViewRenderer'.Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) 0x00029 in <8b3b636835d84984ba4604c1f57b1983>:0 (System.String encodedMember,Java.Interop.IJavaPeerable self,Java.Interop.JniArgumentValue*参数) 0x00000 in <8b3b636835d84984ba4604c1f57b1983>:0 at AndroidX.RecyclerView.Widget.RecyclerView.AddItemDecoration (AndroidX.RecyclerView.Widget.RecyclerView+ItemDecoration decor) 0x00031 in <2ad99d4ff8bf46979e52d9bcdac6318e>:0 at Xamarin.Forms.Platform.Android.CarouselViewRenderer.UpdateItemDecoration () 0x00026 in <04c545f414d24a37af95d995791bb9a9>:0

可悲的是,这个错误是不可复制的,而且只发生在生产中。我认为这是处置和UpdateItemDecoration之间的种族条件。

github:https://github.com/xamarin/Xamarin.Forms/issues/14316上已经存在一个bug

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-07-07 12:46:34

这是由于在处理之前清除ItemsSource集合造成的。当我们已经知道当前视图将被释放时,我们的解决方案是在清除绑定集合之前将CarouselView的CarouselView设置为null。对不起,我不能提供我们的应用程序的来源。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72898056

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档