0

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)
SushiHangover
  • 73,120
  • 10
  • 106
  • 165
jatin kinra
  • 103
  • 2
  • 6

2 Answers2

0

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

SushiHangover
  • 73,120
  • 10
  • 106
  • 165
  • I have a similar problem. Log looks the same but the object is Xamarin.Forms.Platform.Android.FastRenderers.ButtonRenderer. Your solution didn't fix it. Any other ideas? – Dpedrinha Aug 24 '17 at 06:22
  • 1
    @Dpedrinha If it is `FastRenderers`-based issue, report it to Xamarin as the FastRenderers are still a work in progress : http://bugzilla.xamarin.com/ After that, disable the fast renderers till they publish a fix to test.... – SushiHangover Aug 24 '17 at 06:26
  • God I was so close... I will, but they will ask for a repro and I most probably won't be able to reproduce it. – Dpedrinha Aug 24 '17 at 06:30
  • @jatinkinra Glad to hear it ;-) – SushiHangover Aug 28 '17 at 09:16
0

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

Dpedrinha
  • 3,741
  • 3
  • 38
  • 57