I am having a slight issue with on Page containing a ListView. When I Pop the page the call
await Navigation.PopAsync();
results in a NullReferenceException
with the following stack trace:
System.NullReferenceException: Object reference not set to an instance of an object
Thread finished: #8
2015-02-26 10:45:36.059 DerpAppiOS[2113:277365] Unhandled managed exception: Object reference not set to an instance of an object (System.NullReferenceException)
at Xamarin.Forms.Platform.iOS.ViewRenderer`2[Xamarin.Forms.View,UIKit.UIView].Dispose (Boolean disposing) [0x00000] in <filename unknown>:0
at Foundation.NSObject.Dispose () [0x00000] in /Developer/MonoTouch/Source/maccore/src/Foundation/NSObject2.cs:131
at Xamarin.Forms.Platform.iOS.Platform.DisposeModelAndChildrenRenderers (Xamarin.Forms.Element view) [0x00000] in <filename unknown>:0
at Xamarin.Forms.Platform.iOS.ViewCellRenderer+ViewTableCell.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0
at Foundation.NSObject.Dispose () [0x00000] in /Developer/MonoTouch/Source/maccore/src/Foundation/NSObject2.cs:131
at Xamarin.Forms.Platform.iOS.ListViewRenderer.Dispose (Boolean disposing) [0x00000] in <filename unknown>:0
at Foundation.NSObject.Dispose () [0x00000] in /Developer/MonoTouch/Source/maccore/src/Foundation/NSObje
ct2.cs:131
at Xamarin.Forms.Platform.iOS.Platform.DisposeModelAndChildrenRenderers (Xamarin.Forms.Element view) [0x00000] in <filename unknown>:0
at Xamarin.Forms.Platform.iOS.Platform.HandleChildRemoved (System.Object sender, Xamarin.Forms.ElementEventArgs e) [0x00000] in <filename unknown>:0
at Xamarin.Forms.Element.OnDescendantRemoved (Xamarin.Forms.Element child) [0x00000] in <filename unknown>:0
at Xamarin.Forms.Element.OnChildRemoved (Xamarin.Forms.Element child) [0x00000] in <filename unknown>:0
at Xamarin.Forms.Page.OnInternalRemoved (Xamarin.Forms.VisualElement view) [0x00000] in <filename unknown>:0
at Xamarin.Forms.Page.InternalChildrenOnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in <filename unknown>:0
at System.Collections.ObjectModel.ObservableCollection`1[Xamarin.Forms.Element].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00014] in /Developer/MonoTouch/So
urce/monotouch/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System/System.Collections.ObjectModel/ObservableCollection.cs:161
at System.Collections.ObjectModel.ObservableCollection`1[Xamarin.Forms.Element].RemoveItem (Int32 index) [0x0001a] in /Developer/MonoTouch/Source/monotouch/_build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System/System.Collections.ObjectModel/ObservableCollection.cs:182
at System.Collections.ObjectModel.Collection`1[Xamarin.Forms.Element].Remove (Xamarin.Forms.Element item) [0x00011] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Collections.ObjectModel/Collection.cs:134
at Xamarin.Forms.NavigationPage+<PopAsyncInner>d__1e.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.Exceptio
The thread 0x8 has exited with code 0 (0x0).
nServices/ExceptionDispatchInfo.cs:62
at System.Runtime.CompilerServices.TaskAwaiter`1[Xamarin.Forms.Page].GetResult () [0x00034] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.CompilerServices/TaskAwaiter_T.cs:59
at Xamarin.Forms.NavigationPage+<PopAsync>d__16.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:62
at System.Runtime.CompilerServices.TaskAwaiter`1[Xamarin.Forms.Page].GetResult () [0x00034] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.CompilerServices/TaskAwaiter_T.cs:59
at DerpApp.Pages.DerpListPage+<toolBarView_LeftClick>d__e.MoveNext () [0x0001e] in c:\vcs\git\derp-app4\Source\DerpApp\DerpApp\Pages\DerpListPage.cs:188
Looking at the trace, it seems like it is disposing of all the views in the hierarchy, however something, somewhere is already null or been disposed off and now when trying to dispose it, an error is thrown.
This is on latest stable Nuget of Xamarin.Forms 1.3.4
Now wrapping it in a try/catch solves this temporarily, but which implications does that have?