Bug 59000 - System.ObjectDisposedException: Cannot access a disposed object.
Summary: System.ObjectDisposedException: Cannot access a disposed object.
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.5
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jimmy [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-08-24 07:14 UTC by dpedrinha
Modified: 2017-08-26 06:00 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description dpedrinha 2017-08-24 07:14:27 UTC
Every time I pop a boolean page from my app, this exception makes my app crash.

The log doesn't help me pinpointing the problem. I hope it means something to you.

08-24 09:00:04.745 I/MonoDroid(15784): UNHANDLED EXCEPTION:
08-24 09:00:04.845 I/MonoDroid(15784): System.ObjectDisposedException: Cannot access a disposed object.
08-24 09:00:04.845 I/MonoDroid(15784): Object name: 'Xamarin.Forms.Platform.Android.FastRenderers.ButtonRenderer'.
08-24 09:00:04.845 I/MonoDroid(15784):   at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in <bd30a18775d94dc8b6263aecd1ca9077>:0 
08-24 09:00:04.845 I/MonoDroid(15784):   at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeNonvirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in <bd30a18775d94dc8b6263aecd1ca9077>:0 
08-24 09:00:04.845 I/MonoDroid(15784):   at Android.Views.View.Measure (System.Int32 widthMeasureSpec, System.Int32 heightMeasureSpec) [0x00035] in <d855bac285f44dda8a0d8510b679b1e2>:0 
08-24 09:00:04.845 I/MonoDroid(15784):   at Xamarin.Forms.Platform.Android.FastRenderers.ButtonRenderer.Xamarin.Forms.Platform.Android.IVisualElementRenderer.GetDesiredSize (System.Int32 widthConstraint, System.Int32 heightConstraint) [0x00006] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\NavigationPageRenderer.cs:210 
08-24 09:00:04.845 I/MonoDroid(15784):   at Xamarin.Forms.Platform.Android.AppCompat.Platform.Xamarin.Forms.Internals.IPlatform.GetNativeSize (Xamarin.Forms.VisualElement view, System.Double widthConstraint, System.Double heightConstraint) [0x0000a] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Cells\ViewCellRenderer.cs:87 
08-24 09:00:04.845 I/MonoDroid(15784):   at Xamarin.Forms.VisualElement.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x0002d] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:632 
08-24 09:00:04.845 I/MonoDroid(15784):   at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:601 
08-24 09:00:04.845 I/MonoDroid(15784):   at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:477 
08-24 09:00:04.845 I/MonoDroid(15784):   at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:535 
08-24 09:00:04.845 I/MonoDroid(15784):   at Xamarin.Forms.StackLayout.CalculateNaiveLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint) [0x00236] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\StackLayout.cs:186 
08-24 09:00:04.845 I/MonoDroid(15784):   at Xamarin.Forms.StackLayout.CalculateLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint, System.Boolean processExpanders) [0x00058] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\StackLayout.cs:111 
08-24 09:00:04.845 I/MonoDroid(15784):   at Xamarin.Forms.StackLayout.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x0005b] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\StackLayout.cs:45 
08-24 09:00:04.845 I/MonoDroid(15784):   at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x000c7] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:235 
08-24 09:00:04.845 I/MonoDroid(15784):   at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:200 
08-24 09:00:04.845 I/MonoDroid(15784):   at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:637 
08-24 09:00:04.855 I/MonoDroid(15784):   at Xamarin.Forms.Layout+<>c.<OnChildMeasureInvalidated>b__39_0 () [0x00080] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:338 
08-24 09:00:04.855 I/MonoDroid(15784):   at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <d855bac285f44dda8a0d8510b679b1e2>:0 
08-24 09:00:04.855 I/MonoDroid(15784):   at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <d855bac285f44dda8a0d8510b679b1e2>:0 
08-24 09:00:04.855 I/MonoDroid(15784):   at (wrapper dynamic-method) System.Object:fdcc52c3-0271-4895-8fc5-0171fc85950c (intptr,intptr)
08-24 09:00:04.885 W/art     (15784): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable
08-24 09:00:04.885 D/Mono    (15784): DllImport searching in: '__Internal' ('(null)').
08-24 09:00:04.885 D/Mono    (15784): Searching for 'java_interop_jnienv_throw'.
08-24 09:00:04.885 D/Mono    (15784): Probing 'java_interop_jnienv_throw'.
08-24 09:00:04.885 D/Mono    (15784): Found as 'java_interop_jnienv_throw'.
08-24 09:00:05.766 E/mono    (15784): 
08-24 09:00:05.766 E/mono    (15784): Unhandled Exception:
08-24 09:00:05.766 E/mono    (15784): System.ObjectDisposedException: Cannot access a disposed object.
08-24 09:00:05.766 E/mono    (15784): Object name: 'Xamarin.Forms.Platform.Android.FastRenderers.ButtonRenderer'.
08-24 09:00:05.766 E/mono-rt (15784): [ERROR] FATAL UNHANDLED EXCEPTION: System.ObjectDisposedException: Cannot access a disposed object.
08-24 09:00:05.766 E/mono-rt (15784): Object name: 'Xamarin.Forms.Platform.Android.FastRenderers.ButtonRenderer'.

And yes, I know you want a repro, but I couldn't reproduce the problem. Btw, it's working on other platforms and I don't have any renderer in Android. So, the problem seems to be with FastRenderers, GC or something else deep in your Android code.

But, I'm open for suggestions to try.

Thanks.
Comment 2 Jimmy [MSFT] 2017-08-24 17:33:04 UTC
Is this happening with Forms 2.4.0-pre1? There were changes in this release for similar crashes with other fast renderers so let me know if you are still seeing this with the latest pre-release. Thanks!
Comment 3 dpedrinha 2017-08-26 05:58:44 UTC
That fixed the problem. Thanks.

Is there any know issues with this version compared to the previous versions?
Comment 4 dpedrinha 2017-08-26 06:00:20 UTC
Resolved