jobject must not be IntPtr.Zero (Xamarin)

I have a Xamarin.Forms application in which the user goes to several pages. The first few pages have no problem, but when the user pops a page back to the menu and clicks a new label the entire program crashes with the following unhandled exception.

This is how the flow of the program goes:
Page1 -> page2 -> page1 -> page3 -> page4 -> page3 -> page1 -> (new)page3 -> (new)page4 -> page3 -> (new)page4 (here is where it crashes)

[mono] Unhandled Exception:

[mono] System.ArgumentException: 'jobject' must not be IntPtr.Zero.

[mono] Parameter name: jobject

[mono] at Android.Runtime.JNIEnv.CallObjectMethod (IntPtr jobject, IntPtr jmethod) [0x00010] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:170

[mono] at Android.Views.View.get_Parent () [0x0002d] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.Views.View.cs:7001

[mono] at Xamarin.Forms.Platform.Android.ViewExtensions.RemoveFromParent (Android.Views.View view) [0x00000] in :0

[mono] at Xamarin.Forms.Platform.Android.ViewPackager.RemoveChild (Xamarin.Forms.VisualElement view) [0x00000] in :0

[mono] at Xamarin.Forms.Platform.Android.ViewPackager.OnChildRemoved (System.Object sender, Xamarin.Forms.ElementEventArgs e) [0x00000] in :0

[mono] at Xamarin.Forms.Element.OnChildRemoved (Xamarin.Forms.Element child) [0x00000] in :0

[mono] at Xamarin.Forms.Page.OnInternalRemoved (Xamarin.Forms.VisualElement view) [0x00000] in :0

[mono] at Xamarin.Forms.Page.InternalChildrenOnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in :0

[mono] at System.Collections.ObjectModel.ObservableCollection`1[Xamarin.Forms.Element].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in :0

[mono] at System.Collections.ObjectModel.ObservableCollection`1[Xamarin.Forms.Element].RemoveItem (Int32 index) [0x00000] in :0

[mono] at System.Collections.ObjectModel.Collection`1[Xamarin.Forms.Element].Remove (Xamarin.Forms.Element item) [0x00000] in :0

[mono] at Xamarin.Forms.ContentPage.set_Content (Xamarin.Forms.View value) [0x00000] in :0

[mono] at Euroscangroup.MobileApplications.RecorderSettingsPage.Finalize () [0x00000] in c:\Users\jsavelberg\Desktop\Persoonlijk SVN\Project\MobileApplications\MobileApplications\MobileApplications\Pages\RecorderSettingsPage.xaml.cs:562

Could someone please tell me what's wrong?

Sign In or Register to comment.