有时,我们的应用程序会崩溃,但有以下例外:
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
发布于 2022-07-07 12:46:34
这是由于在处理之前清除ItemsSource集合造成的。当我们已经知道当前视图将被释放时,我们的解决方案是在清除绑定集合之前将CarouselView的CarouselView设置为null。对不起,我不能提供我们的应用程序的来源。
https://stackoverflow.com/questions/72898056
复制相似问题