首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >System.ObjectDisposedException:无法访问已释放的对象。对象名称:'Syncfusion.ListView.XForms.Android.ExtendedScrollViewRenderer‘

System.ObjectDisposedException:无法访问已释放的对象。对象名称:'Syncfusion.ListView.XForms.Android.ExtendedScrollViewRenderer‘
EN

Stack Overflow用户
提问于 2017-11-19 01:53:27
回答 1查看 3.1K关注 0票数 0

我有一个带有SyncFusion列表视图(SfListView)的Xamarin.Forms应用程序。导致Android频繁死机,错误如下:

代码语言:javascript
复制
Unhandled exception: System.ObjectDisposedException: Cannot access a disposed object.
 Object name: 'Syncfusion.ListView.XForms.Android.ExtendedScrollViewRenderer'.
at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in <7cfbebb561c54efc9010b018c0846c7e>:0 
 at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualBooleanMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in <7cfbebb561c54efc9010b018c0846c7e>:0 
 at Android.Views.View.get_IsLayoutRequested () [0x0000a] in <9ef29c909d7e4606a46b131129da3975>:0 
  at Xamarin.Forms.Platform.Android.ScrollViewRenderer+<OnScrollToRequested>d__58.MoveNext () [0x000ce] in D:\agent\_work\1\s\Xamarin.Forms.Platform.Android\Renderers\ScrollViewRenderer.cs:309 
 --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 
at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <9ef29c909d7e4606a46b131129da3975>:0 
at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <9ef29c909d7e4606a46b131129da3975>:0 
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <9ef29c909d7e4606a46b131129da3975>:0 
at (wrapper dynamic-method) System.Object:ab79b1ac-9c45-4d56-89ec-c42ce2376e50 (intptr,intptr)

我已经联系了SyncFusion,他们说这是一个框架问题。

列表视图被呈现到一个自定义选项卡式容器中。

与Xamarin.Forms 2.3到2.5 (最新版本)一起使用,但问题仍然存在。对此有什么建议或想法吗?

EN

回答 1

Stack Overflow用户

发布于 2020-02-24 23:13:48

this thread上可能有一个解决方案,只需查看评论即可。问题的根源似乎在于清除ObservableCollection列表的方式;您应该尝试将其分配给新列表,而不是使用.Clear()方法:

因此,不是:

代码语言:javascript
复制
ObservableCollectionProperty.Clear();

使用:

代码语言:javascript
复制
ObservableCollectionProperty = new ObservableCollection<TypeGoesHere>();

希望这会有所帮助,因为它似乎解决了我在提供的链接中提到的自定义控件所面临的问题。

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

https://stackoverflow.com/questions/47369244

复制
相关文章

相似问题

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