Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Android NullReferenceException after removing view as ContentView.Content and setting it again.

$
0
0

Hi

In a project I am working on we have background view (which is displaying a map). On to of that view we have a view which can cover parts of the background and can be minimized (slide down only showing a maximize button) and maximized (slide up, covering up to 80 % of the height of the background view). The content of this view (which is a contentview) can be changed and the height of it can change (cover more or less of the background). I have implemented a simple navigation stack for this view so that one can push a new view which is displayed and then pop it to show the an older view (if there is one). This works fine except that on one view: Where I display a listview, which contains custom cellviews, which contains an absolute layout, which in turn has so dynamically created boxviews in it (this absolute layout represents a day and a boxview represents a meeting, so lets call it a meeting bar). When I tap on one of the items in the list you navigate to a detailed view of that item, which works fine. However when one pops (goes back to the listview) the renderer(?) for the earlier created boxviews seems to be broken. And after a while (when you scroll in the list etc.) the app crash with this stacktrack:

{System.NullReferenceException: Object reference not set to an instance of an object.
at Xamarin.Forms.Platform.Android.VisualElementPackager.RemoveChild (Xamarin.Forms.VisualElement view) [0x00014] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:152
at Xamarin.Forms.Platform.Android.VisualElementPackager.OnChildRemoved (System.Object sender, Xamarin.Forms.ElementEventArgs e) [0x0000f] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:138
at (wrapper delegate-invoke) System.EventHandler1[Xamarin.Forms.ElementEventArgs]:invoke_void_object_TEventArgs (object,Xamarin.Forms.ElementEventArgs) at Xamarin.Forms.Element.OnChildRemoved (Xamarin.Forms.Element child) [0x0000f] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:366 at Xamarin.Forms.VisualElement.OnChildRemoved (Xamarin.Forms.Element child) [0x00000] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:578 at Xamarin.Forms.Layout1[T].OnChildRemoved (Xamarin.Forms.Element child) [0x00000] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:40
at Xamarin.Forms.Layout.OnInternalRemoved (Xamarin.Forms.View view) [0x00012] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:417
at Xamarin.Forms.Layout.InternalChildrenOnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x0002f] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:381
at (wrapper delegate-invoke) :invoke_void_object_NotifyCollectionChangedEventArgs (object,System.Collections.Specialized.NotifyCollectionChangedEventArgs)
at System.Collections.ObjectModel.ObservableCollection1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00012] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:288 at System.Collections.ObjectModel.ObservableCollection1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00000] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:351
at System.Collections.ObjectModel.ObservableCollection1[T].RemoveItem (System.Int32 index) [0x0002b] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:205 at System.Collections.ObjectModel.Collection1[T].Remove (T item) [0x0002d] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/referencesource/mscorlib/system/collections/objectmodel/collection.cs:113
at Xamarin.Forms.ObservableWrapper2[TTrack,TRestrict].Remove (TRestrict item) [0x00035] in C:\BuildAgent\work\ca3766cfc22354a1\Xamarin.Forms.Core\ObservableWrapper.cs:83 at Gaia.Places.App.Appmod.M206.Views.BookingsBar.SetMeetings (System.Collections.Generic.IEnumerable1[T] meetings) [0x00088] in F:\dev\SBG\APP-APPFW-NODEXAMARIN\Gaia.Places.App\Gaia.Places.App\Modules\Gaia.Places.App.Appmod.M206\Views\BookingsBar.xaml.cs:96 }


Viewing all articles
Browse latest Browse all 204402

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>