Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

New release still contains listview binding issue

$
0
0

I noticed that there is a new nuget package available (1.2.1.6224) so I decided to see whether the bug I reported is now fixed: http://forums.xamarin.com/discussion/comment/64332#Comment_64332

It is fixed.. I got the output I expected, but my app still didn't work (obviously to report the bug, I came up with the simplest repro I could)

So I changed the xaml from

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                       x:Class="TestProject.Main">
  <ListView ItemsSource="{Binding Values}">
    <ListView.ItemTemplate>
      <DataTemplate>
        <ViewCell>
          <ViewCell.View>
            <Label Text="{Binding}"></Label>
          </ViewCell.View>
        </ViewCell>
      </DataTemplate>
    </ListView.ItemTemplate>
  </ListView>
</ContentPage>

to

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                       x:Class="TestProject2.Main">
  <ListView ItemsSource="{Binding Values}">
    <ListView.ItemTemplate>
      <DataTemplate>
        <ViewCell>
          <ViewCell.View>
            <StackLayout>
              <Label Text="{Binding}"></Label>
              <ContentView></ContentView>
            </StackLayout>
          </ViewCell.View>
        </ViewCell>
      </DataTemplate>
    </ListView.ItemTemplate>
  </ListView>
</ContentPage>

and I get the exception below. Funnily enough this isn't actually what happens in my app, my app still just shows the last item repeated however many times there are items, but I can't currently reproduce that issue because I just get this problem instead

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

Unhandled Exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.NavigationProxy.set_Inner (INavigation value) [0x00000] in :0
at Xamarin.Forms.VisualElement.OnParentSet () [0x00000] in :0
at Xamarin.Forms.Element.set_Parent (Xamarin.Forms.Element value) [0x00000] in :0
at Xamarin.Forms.Element.OnChildAdded (Xamarin.Forms.Element child) [0x00000] in :0
at Xamarin.Forms.Layout.OnInternalAdded (Xamarin.Forms.View view) [0x00000] in :0
at Xamarin.Forms.Layout.InternalChildrenOnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in :0
at (wrapper delegate-invoke) :invoke_void__this___object_NotifyCollectionChangedEventArgs (object,System.Collections.Sp
ecialized.NotifyCollectionChangedEventArgs)
at (wrapper delegate-invoke) :invoke_void__this___object_NotifyCollectionChangedEventArgs (object,System.Collections.Specialized.NotifyCollectionChangedEventArgs)
at System.Collections.ObjectModel.ObservableCollection

1[Xamarin.Forms.Element].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00014] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Collections.ObjectModel/ObservableCollection.cs:161 
  at System.Collections.ObjectModel.ObservableCollection
1[Xamarin.Forms.Element].InsertItem (Int32 index, Xamarin.Forms.Element item) [0x0000e] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Collections.ObjectModel/ObservableCollection.cs:131
at System.Collections.ObjectModel.Collection
1[Xamarin.Forms.Element].Add (Xamarin.Forms.Element item) [0x0000c] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Collections.ObjectModel/Collection.cs:81 
  at Xamarin.Forms.ObservableWrapper
2[
Xamarin.Forms.Element,Xamarin.Forms.View].Add (Xamarin.Forms.View item) [0x00000] in :0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00044] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0005c] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:238
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/
System.Reflection/MethodBase.cs:114
at Xamarin.Forms.Xaml.ListNode.ApplyTo (System.Object source, XmlName propertyName, Boolean dontUseLazy) [0x00000] in :0
at Xamarin.Forms.Xaml.INodeExtension.ApplyProperties (IElementNode node, System.Object source, Boolean dontUseLazy) [0x00000] in :0
at Xamarin.Forms.Xaml.ElementNode.ApplyProperties (System.Object source, Boolean dontUseLazy) [0x00000] in :0
at Xamarin.Forms.Xaml.ElementNode.Create (Boolean dontUseLazy) [0x00000] in :0
at Xamarin.Forms.Xaml.ElementNode.ApplyTo (System.Object source, XmlName propertyName, Boolean dontUseLazy) [0x00000] in :0
at Xamarin.Forms.Xaml.INodeExtension.ApplyProperties (IElementNode node, System.Object source, Boolean dontUseLazy) [0x00000] in :0
at Xamarin.Forms.Xaml.ElementNode.ApplyProperties (System.Object source, Boolean dontUseLazy) [0x00000] in :0
at Xamarin.Forms.Xaml.ElementN
ode.Create (Boolean dontUseLazy) [0x00000] in :0
at Xamarin.Forms.Xaml.ElementNode.b__a () [0x00000] in :0
at System.Lazy
1[System.Object].InitValue () [0x0014f] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Lazy.cs:156 
2014-07-13 23:26:07.206 FormsTemplateiOS[14564:80b] Unhandled managed exception: Exception has been thrown by the target of an invocation. (System.Reflection.TargetInvocationException)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0005c] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:238 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MethodBase.cs:114 
  at Xamarin.Forms.Xaml.ListNode.ApplyTo (System.Object source, XmlName propertyName, Boolean dontUseLazy) [0x00000] in <filename unknown>:0 
  at Xamarin.Forms.Xaml.INodeExtension.ApplyProperties (IElementNode node, System.Object source, Boolean dontUseLazy) [0x00000] in <filename unknown>:0 
  at Xamarin.Forms.Xaml.ElementNode.ApplyProperties (System.Object
 source, Boolean dontUseLazy) [0x00000] in <filename unknown>:0 
  at Xamarin.Forms.Xaml.ElementNode.Create (Boolean dontUseLazy) [0x00000] in <filename unknown>:0 
  at Xamarin.Forms.Xaml.ElementNode.ApplyTo (System.Object source, XmlName propertyName, Boolean dontUseLazy) [0x00000] in <filename unknown>:0 
  at Xamarin.Forms.Xaml.INodeExtension.ApplyProperties (IElementNode node, System.Object source, Boolean dontUseLazy) [0x00000] in <filename unknown>:0 
  at Xamarin.Forms.Xaml.ElementNode.ApplyProperties (System.Object source, Boolean dontUseLazy) [0x00000] in <filename unknown>:0 
  at Xamarin.Forms.Xaml.ElementNode.Create (Boolean dontUseLazy) [0x00000] in <filename unknown>:0 
  at Xamarin.Forms.Xaml.ElementNode.<SetDataTemplate>b__a () [0x00000] in <filename unknown>:0 
  at System.Lazy
1[System.Object].InitValue () [0x0014f] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/Lazy.cs:156

Viewing all articles
Browse latest Browse all 58056

Trending Articles



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