SlidingMenuSharp System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Android.Widget.Scroller'

风格不统一 提交于 2019-12-23 05:49:08

问题


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.

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)

回答1:


Use the new GC Bridge vs. the default tarjan:

MONO_GC_PARAMS=bridge-implementation=new

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.

Rebuild and test your project.

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




回答2:


Update Xamarin.Forms to 2.4.0-pre1 and it should be fixed.



来源:https://stackoverflow.com/questions/45728128/slidingmenusharp-system-objectdisposedexception-cannot-access-a-disposed-object

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!