SlidingMenuSharp System.ObjectDisposedException:无法访问已处置的对象.对象名称:"Android.Widget.Scroller" [英] SlidingMenuSharp System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Android.Widget.Scroller'

查看:107
本文介绍了SlidingMenuSharp System.ObjectDisposedException:无法访问已处置的对象.对象名称:"Android.Widget.Scroller"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个Xamarin.Android 7应用程序. 我们收到以下导致应用崩溃的异常. 它说明了有关Android.Widget.Scroller的信息,但我们并未在任何地方的应用程序中显式使用此组件. 不过,我们在xaml文件中使用了ScrollView和GridView.

We have a Xamarin.Android 7 app. We are getting the following exception which causes the app to crash. It says something about Android.Widget.Scroller, but we are not using this component explicitly in our app anywhere. We are using ScrollView and GridView in xaml files though.

我们遇到的一个解决方案是移回Xamarin.Android 6,但是由于应用程序要求,这不是可行的解决方案. 我们遇到的另一种解决方案是使用ListViewCachingStrategy,但在Xamarin.Android中找不到如何做到这一点.

One solution which we came across was to move back to Xamarin.Android 6, but that is not a feasible solution due to app requirements. One more solution we came across was to use ListViewCachingStrategy, but couldn't find how to do that in Xamarin.Android.

请在这里帮助我们,这是我们任务中的巨大障碍.

Please help us out here, this is huge roadblock in our task.

System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Android.Widget.Scroller'.
at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in <5716a943049b49ca928a3a1c8d2386f4>:0 
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeNonvirtualBooleanMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in <5716a943049b49ca928a3a1c8d2386f4>:0 
at Android.Widget.Scroller.get_IsFinished () [0x0000a] in <8804aaaf21bc4f45b576b50092b57059>:0 
at SlidingMenuSharp.CustomViewAbove.ComputeScroll () [0x00001] in <20b4998942db4089b3ed88297710fab6>:0 
at Android.Views.View.n_ComputeScroll (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <8804aaaf21bc4f45b576b50092b57059>:0 
at (wrapper dynamic-method) System.Object:0044ef4c-4a4e-4ecd-8301-8be4cc63baea (intptr,intptr)

推荐答案

使用new GC桥与默认tarjan:

MONO_GC_PARAMS=bridge-implementation=new

Xamarin.Android项目中创建一个文本文件,并在其上设置AndroidEnvironment的构建类型,并在上方添加MONO_GC_PARAMS行.

Create an text file within your Xamarin.Android project and set a build type of AndroidEnvironment on it and include the MONO_GC_PARAMS line from above.

重建并测试您的项目.

回复: https://developer.xamarin.com/guides/android/advanced_topics/garbage_collection/#GC_Bridge_Options

这篇关于SlidingMenuSharp System.ObjectDisposedException:无法访问已处置的对象.对象名称:"Android.Widget.Scroller"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆