Bug 29229 - ListView on Windows Phone
Summary: ListView on Windows Phone
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 1.4.0
Hardware: PC Windows
: --- major
Target Milestone: ---
Assignee: Eric Maupin
URL:
Depends on:
Blocks:
 
Reported: 2015-04-19 11:36 UTC by Benedikt Hübschen
Modified: 2015-06-25 10:30 UTC (History)
3 users (show)

Tags: ac
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 Benedikt Hübschen 2015-04-19 11:36:27 UTC
{System.NullReferenceException: Object reference not set to an instance of an object.
   at Xamarin.Forms.Platform.WinPhone.ListViewRenderer.UpdateNativeWidget()
   at Xamarin.Forms.Platform.WinPhone.VisualElementRenderer`2.HandleTrackerUpdated(Object sender, EventArgs e)
   at Xamarin.Forms.Platform.WinPhone.VisualElementTracker.OnUpdated()
   at Xamarin.Forms.Platform.WinPhone.VisualElementTracker`2.UpdateNativeControl()
   at Xamarin.Forms.Platform.WinPhone.VisualElementTracker`2.set_Child(FrameworkElement value)
   at Xamarin.Forms.Platform.WinPhone.VisualElementRenderer`2.SetNativeControl(TNativeElement element)
   at Xamarin.Forms.Platform.WinPhone.ListViewRenderer.OnElementChanged(ElementChangedEventArgs`1 e)
   at Xamarin.Forms.Platform.WinPhone.VisualElementRenderer`2.SetElement(VisualElement element)
   at Xamarin.Forms.Platform.WinPhone.RendererFactory.GetRenderer(VisualElement view)
   at Xamarin.Forms.Platform.WinPhone.VisualElementPackager.HandleChildAdded(Object sender, ElementEventArgs e)
   at Xamarin.Forms.Element.OnChildAdded(Element child)
   at Xamarin.Forms.AbsoluteLayout.OnChildAdded(Element child)
   at Xamarin.Forms.Layout.OnInternalAdded(View view)
   at Xamarin.Forms.Layout.InternalChildrenOnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
   at System.Collections.ObjectModel.Collection`1.Add(T item)
   at Xamarin.Forms.ObservableWrapper`2.Add(TRestrict item)
   at Xamarin.Forms.AbsoluteLayout.AbsoluteElementCollection.Add(View view, Rectangle bounds, AbsoluteLayoutFlags flags)
   at FeuerwehrCloud.App.FetchForm(AbsoluteLayout Parent, XNode Nodes)
   at FeuerwehrCloud.App.HandleClick(Object sender, EventArgs e)}
    [System.NullReferenceException]: {System.NullReferenceException: Object reference not set to an instance of an object.
   at Xamarin.Forms.Platform.WinPhone.ListViewRenderer.UpdateNativeWidget()
   at Xamarin.Forms.Platform.WinPhone.VisualElementRenderer`2.HandleTrackerUpdated(Object sender, EventArgs e)
   at Xamarin.Forms.Platform.WinPhone.VisualElementTracker.OnUpdated()
   at Xamarin.Forms.Platform.WinPhone.VisualElementTracker`2.UpdateNativeControl()
   at Xamarin.Forms.Platform.WinPhone.VisualElementTracker`2.set_Child(FrameworkElement value)
   at Xamarin.Forms.Platform.WinPhone.VisualElementRenderer`2.SetNativeControl(TNativeElement element)
   at Xamarin.Forms.Platform.WinPhone.ListViewRenderer.OnElementChanged(ElementChangedEventArgs`1 e)
   at Xamarin.Forms.Platform.WinPhone.VisualElementRenderer`2.SetElement(VisualElement element)
   at Xamarin.Forms.Platform.WinPhone.RendererFactory.GetRenderer(VisualElement view)
   at Xamarin.Forms.Platform.WinPhone.VisualElementPackager.HandleChildAdded(Object sender, ElementEventArgs e)
   at Xamarin.Forms.Element.OnChildAdded(Element child)
   at Xamarin.Forms.AbsoluteLayout.OnChildAdded(Element child)
   at Xamarin.Forms.Layout.OnInternalAdded(View view)
   at Xamarin.Forms.Layout.InternalChildrenOnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
   at System.Collections.ObjectModel.Collection`1.Add(T item)
   at Xamarin.Forms.ObservableWrapper`2.Add(TRestrict item)
   at Xamarin.Forms.AbsoluteLayout.AbsoluteElementCollection.Add(View view, Rectangle bounds, AbsoluteLayoutFlags flags)
   at FeuerwehrCloud.App.FetchForm(AbsoluteLayout Parent, XNode Nodes)
   at FeuerwehrCloud.App.HandleClick(Object sender, EventArgs e)}
    Data: {System.Collections.ListDictionaryInternal}
    HelpLink: null
    HResult: -2147467261
    InnerException: null
    Message: "Object reference not set to an instance of an object."
    Source: "Xamarin.Forms.Platform.WP8"





Code:
        public static Page GetMainPage()
        {
            ContentPage cP = new ContentPage();
            cP.MinimumWidthRequest = ContentWidth;
            cP.MinimumHeightRequest = ContentHeight;
            var absLayout = new AbsoluteLayout();
            absLayout.BackgroundColor = Color.Red;
            absLayout.Scale = 1;
            absLayout.MinimumWidthRequest = ContentWidth;
            absLayout.MinimumHeightRequest = ContentHeight;
            App.Navigation = new NavigationPage(cP);
            var CPx = new Xamarin.Forms.ListView ();
            Point ptx = Point.Zero;
            CPx.ItemTapped += delegate(object sender, ItemTappedEventArgs e) {
            }
            CPx.ClassId = "weather";
            CPx.Layout (new Rectangle (0,0,480,768));
            absLayout.Children.Add (CPx, new Rectangle (CPx.X, CPx.Y, CPx.Width, CPx.Height), AbsoluteLayoutFlags.None);
            absLayout.LowerChild (CPx);
            cP.Content = absLayout;
            return App.Navigation;
        }
Comment 1 Fredy Wenger 2015-05-12 05:09:27 UTC
XF 1.4.3-Pre-2.
I have a similar issue (ONLY on WP).
I use the XLabs PopUp-Control to show some ListViews on it.
It works by the first attempt.
As soon, as I call the PopUp a second time, the app crashes with:
System.NullReferenceException ist aufgetreten.
  _HResult=-2147467261
  _message=Object reference not set to an instance of an object.
  HResult=-2147467261
  IsTransient=false
  Message=Object reference not set to an instance of an object.
  Source=Xamarin.Forms.Platform.WP8
  StackTrace:
       at Xamarin.Forms.Platform.WinPhone.ListViewRenderer.UpdateNativeWidget()
  InnerException:

while it works on iOS and Android.
This makes my App unusable on WP.

Code that crahes by SECOND call:

 _PopUpLayout.ShowPopup(PopUpPLZOrt, Constraint.Constant(Position), Constraint.Constant(20));


This has worked in earlier versions.
Comment 2 Fredy Wenger 2015-05-12 05:12:36 UTC
Addition crash-information:
+		_exception	{System.NullReferenceException: Object reference not set to an instance of an object.
   at Xamarin.Forms.Platform.WinPhone.ListViewRenderer.UpdateNativeWidget()
   at Xamarin.Forms.Platform.WinPhone.VisualElementRenderer`2.HandleTrackerUpdated(Object sender, EventArgs e)
   at Xamarin.Forms.Platform.WinPhone.VisualElementTracker.OnUpdated()
   at Xamarin.Forms.Platform.WinPhone.VisualElementTracker`2.UpdateNativeControl()
   at Xamarin.Forms.Platform.WinPhone.VisualElementTracker`2.set_Child(FrameworkElement value)
   at Xamarin.Forms.Platform.WinPhone.VisualElementRenderer`2.SetNativeControl(TNativeElement element)
   at Xamarin.Forms.Platform.WinPhone.ListViewRenderer.OnElementChanged(ElementChangedEventArgs`1 e)
   at Xamarin.Forms.Platform.WinPhone.VisualElementRenderer`2.SetElement(VisualElement element)
   at Xamarin.Forms.Platform.WinPhone.RendererFactory.GetRenderer(VisualElement view)
   at Xamarin.Forms.Platform.WinPhone.VisualElementPackager.HandleChildAdded(Object sender, ElementEventArgs e)
   at Xamarin.Forms.Platform.WinPhone.VisualElementPackager.Load()
   at Xamarin.Forms.Platform.WinPhone.VisualElementRenderer`2.SetElement(VisualElement element)
   at Xamarin.Forms.Platform.WinPhone.RendererFactory.GetRenderer(VisualElement view)
   at Xamarin.Forms.Platform.WinPhone.VisualElementPackager.HandleChildAdded(Object sender, ElementEventArgs e)
   at Xamarin.Forms.Element.OnChildAdded(Element child)
   at Xamarin.Forms.Layout.OnInternalAdded(View view)
   at Xamarin.Forms.Layout.InternalChildrenOnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
   at System.Collections.ObjectModel.Collection`1.Add(T item)
   at Xamarin.Forms.ObservableWrapper`2.Add(TRestrict item)
   at Xamarin.Forms.RelativeLayout.RelativeElementCollection.Add(View view, Constraint xConstraint, Constraint yConstraint, Constraint widthConstraint, Constraint heightConstraint)
   at XLabs.Forms.Controls.PopupLayout.ShowPopup(View popupView, Constraint xConstraint, Constraint yConstraint, Constraint widthConstraint, Constraint heightConstraint)
   at MatrixGuide.MG_SuchenPage.<>c__DisplayClass9f.<<.ctor>b__73>d__aa.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__3(Object state)}	System.Exception {System.NullReferenceException}
Comment 3 Fredy Wenger 2015-05-22 03:05:54 UTC
Wow - changed to major and "In progress".
@Eric: Thanks for changing the state, 
Please let us now here, when the bug is solved (as it is a killer).
Comment 4 Eric Maupin 2015-05-22 13:35:02 UTC
This should be fixed in the next 1.4.3 release.
Comment 5 Fredy Wenger 2015-05-26 03:10:39 UTC
@Eric: Thanks for feedback. 
Hopefully this then really solves "My" bug in the real-life app:-)
Comment 6 Fredy Wenger 2015-06-22 08:43:04 UTC
This bug seems to be fixed (at least for my app:-) in R3.