RadListView causes crash when PropertyGroupDescriptor has nulls

12 posts, 0 answers
  1. Aaron
    Aaron avatar
    9 posts
    Member since:
    Sep 2016

    Posted 22 Mar 2017 Link to this post

    Looks like a bug to me in version 2017.1.1220.233...

    The Issue

    Here is my model, I have a collection of these;

    public class Site
    {
        public int SiteId { get; set; }
        public string SiteName { get; set; }
        public string SiteDetailText { get; set; }
        public string FarmName { get; set; }   
    }

     

    Here is the XAML definition of the RadListView;

    <telerikui:RadListView x:Name="SitesList" ItemsSource="{Binding MySites}">
        <telerikui:RadListView.ItemTemplate>
            <DataTemplate>
                        <listView:ListViewTemplateCell>
                                    <listView:ListViewTemplateCell.View>
                                        <Grid Padding="5">
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                            </Grid.RowDefinitions>
             
                                            <Label Grid.Row="0" Text="{Binding SiteName}" FontSize="Large" />
                                            <Label Grid.Row="1" Text="{Binding SiteDetailText}" />
                                        </Grid>
                                </listView:ListViewTemplateCell.View>
                        </listView:ListViewTemplateCell>
                    </DataTemplate>
        </telerikui:RadListView.ItemTemplate>
     
                <!-- this doesn't work -->     
                <telerikui:RadListView.GroupDescriptors>
                  <listView:PropertyGroupDescriptor PropertyName="FarmName" />
                 </telerikui:RadListView.GroupDescriptors>
     
     
    </telerikui:RadListView>

     

    I get the collection of Site models from a JSON string, and sometimes the FarmName property is missing, meaning FarmName is null. When I run the application this exception is thrown;

    03-23 12:08:52.176 I/MonoDroid( 4852): UNHANDLED EXCEPTION:
    03-23 12:08:52.180 I/MonoDroid( 4852): System.ArgumentException: The default comparer works with elements that implement IComparable interface.
    03-23 12:08:52.180 I/MonoDroid( 4852):   at (wrapper managed-to-native) Java.Interop.NativeMethods:java_interop_jnienv_call_nonvirtual_void_method_a (intptr,intptr&,intptr,intptr,intptr,Java.Interop.JniArgumentValue*)
    03-23 12:08:52.180 I/MonoDroid( 4852):   at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0008f] in /Users/builder/data/lanes/4009/9578cdcd/source/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.g.cs:12079 
    03-23 12:08:52.180 I/MonoDroid( 4852):   at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (System.IntPtr jobject, System.IntPtr jclass, System.IntPtr jmethod, Android.Runtime.JValue* parms) [0x00000] in /Users/builder/data/lanes/4009/9578cdcd/source/monodroid/src/Mono.Android/JNIEnv.g.cs:444 
    03-23 12:08:52.180 I/MonoDroid( 4852):   at Com.Telerik.Widget.List.ListViewAdapter.set_Items (System.Collections.IList value) [0x0009d] in <4ab376ccf3e94543ba940e1beffd5307>:0 
    03-23 12:08:52.180 I/MonoDroid( 4852):   at Telerik.XamarinForms.DataControlsRenderer.Android.ListViewDataSourceAdapterExtensions.SetSource (Com.Telerik.Widget.List.ListViewDataSourceAdapter adapter, System.Collections.IEnumerable source) [0x00007] in <0283f7990ca1485d8a9efc5b1581ce6f>:0 
    03-23 12:08:52.180 I/MonoDroid( 4852):   at Telerik.XamarinForms.DataControlsRenderer.Android.ListViewAdapter.UpdateItemsSource (Telerik.XamarinForms.DataControls.RadListView sourceOwner, Com.Telerik.Widget.List.RadListView targetOwner) [0x00011] in <0283f7990ca1485d8a9efc5b1581ce6f>:0 
    03-23 12:08:52.180 I/MonoDroid( 4852):   at Telerik.XamarinForms.DataControlsRenderer.Android.ListViewAdapter.UpdateCore (Telerik.XamarinForms.DataControls.RadListView sourceOwner, Com.Telerik.Widget.List.RadListView targetOwner, System.String propertyName) [0x0004b] in <0283f7990ca1485d8a9efc5b1581ce6f>:0 
    03-23 12:08:52.180 I/MonoDroid( 4852):   at Telerik.XamarinForms.Common.FacadeAdapterBase`2[S,T].Update (System.Object sourceOwner, System.Object targetOwner, System.String propertyName, System.Object sourceOwnerRoot, System.Object targetOwnerRoot) [0x00000] in <41a54de86ddf4ac5b8f46f7114ddd5ec>:0 
    03-23 12:08:52.180 I/MonoDroid( 4852):   at Telerik.XamarinForms.Common.XamarinToNativeControlExtensions.Update[T,K] (T nativeElement, K xfЕlement, System.String propertyName, System.Object sourceOwnerRoot, System.Object targetOwnerRoot) [0x0002b] in <41a54de86ddf4ac5b8f46f7114ddd5ec>:0 
    03-23 12:08:52.180 I/MonoDroid( 4852):   at Telerik.XamarinForms.DataControlsRenderer.Android.ListViewRenderer.OnElementPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00023] in <0283f7990ca1485d8a9efc5b1581ce6f>:0 
    03-23 12:08:52.180 I/MonoDroid( 4852):   at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
    03-23 12:08:52.180 I/MonoDroid( 4852):   at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x0000a] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:137 
    03-23 12:08:52.180 I/MonoDroid( 4852):   at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:379 
    03-23 12:08:52.180 I/MonoDroid( 4852):   at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.BindableObject+SetValueFlags attributes, System.Boolean silent) [0x000f4] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:581 
    03-23 12:08:52.180 I/MonoDroid( 4852):   at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.BindableObject+SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0014b] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:378 
    03-23 12:08:52.180 I/MonoDroid( 4852):   at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x001f9] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:173 
    03-23 12:08:52.180 I/MonoDroid( 4852):   at Xamarin.Forms.BindingExpression.Apply (System.Boolean fromTarget) [0x0003e] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:55 
    03-23 12:08:52.180 I/MonoDroid( 4852):   at Xamarin.Forms.BindingExpression+BindingExpressionPart.<PropertyChanged>b__47_0 () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindingExpression.cs:542 
    03-23 12:08:52.180 I/MonoDroid( 4852):   at Java.Lang.Thread+RunnableImplementor.Run () [0x0000b] in /Users/builder/data/lanes/4009/9578cdcd/source/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:36 
    03-23 12:08:52.180 I/MonoDroid( 4852):   at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in /Users/builder/data/lanes/4009/9578cdcd/source/monodroid/src/Mono.Android/platforms/android-25/src/generated/Java.Lang.IRunnable.cs:81 
    03-23 12:08:52.180 I/MonoDroid( 4852):   at (wrapper dynamic-method) System.Object:7de252d4-c417-4d4a-8229-509ea6b9512e (intptr,intptr)

    The Fix

    If I remove the <RadListView.GroupDescriptors> from the XAML this works fine...

    Also, It works without crashing if I change the definition of the FarmName property to have a default value;

    public string FarmName { get; set; } = "No Farm"

     

    Can we please have it so the List can handle these null values gracefully (empty string maybe)? Either that or show a clearer error message. I've spent 4 hours trying to get this grouping working, and until I stumbled across the stack trace for the IComparer exception I was struggling to figure out where to start.

    Cheers

  2. Aaron
    Aaron avatar
    9 posts
    Member since:
    Sep 2016

    Posted 22 Mar 2017 in reply to Aaron Link to this post

    I suspect this is an issue in latest stable version also
  3. Aaron
    Aaron avatar
    9 posts
    Member since:
    Sep 2016

    Posted 22 Mar 2017 Link to this post

    confirmed busted in 2017.1.10321.233

    different stack trace through;

     

    03-23 12:35:57.793 I/MonoDroid( 6825): UNHANDLED EXCEPTION:
    03-23 12:35:57.833 I/MonoDroid( 6825): Java.Lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference
    03-23 12:35:57.833 I/MonoDroid( 6825):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/4009/f3074d2c/source/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
    03-23 12:35:57.833 I/MonoDroid( 6825):   at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x000a7] in /Users/builder/data/lanes/4009/9578cdcd/source/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.g.cs:12083 
    03-23 12:35:57.834 I/MonoDroid( 6825):   at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeNonvirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00022] in /Users/builder/data/lanes/4009/9578cdcd/source/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:41 
    03-23 12:35:57.834 I/MonoDroid( 6825):   at Android.Views.ViewGroup.Layout (System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00055] in /Users/builder/data/lanes/4009/9578cdcd/source/monodroid/src/Mono.Android/platforms/android-25/src/generated/Android.Views.ViewGroup.cs:3188 
    03-23 12:35:57.834 I/MonoDroid( 6825):   at Xamarin.Forms.Platform.Android.ViewRenderer`2[TView,TNativeView].OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00059] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\ViewRenderer.cs:137 
    03-23 12:35:57.834 I/MonoDroid( 6825):   at Xamarin.Forms.Platform.Android.FormsViewGroup.n_OnLayout_ZIIII (System.IntPtr jnienv, System.IntPtr native__this, System.Boolean p0, System.Int32 p1, System.Int32 p2, System.Int32 p3, System.Int32 p4) [0x00008] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android.FormsViewGroup\obj\Release\generated\src\Xamarin.Forms.Platform.Android.FormsViewGroup.cs:240 
    03-23 12:35:57.834 I/MonoDroid( 6825):   at (wrapper dynamic-method) System.Object:6c49126f-8cc4-4eaa-bbfb-45bbd82d2026 (intptr,intptr,bool,int,int,int,int)
    03-23 12:35:57.834 I/MonoDroid( 6825):   --- End of managed Java.Lang.NullPointerException stack trace ---
    03-23 12:35:57.834 I/MonoDroid( 6825): java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference
    03-23 12:35:57.834 I/MonoDroid( 6825): at com.telerik.widget.list.ListViewAdapter.getItemId(ListViewAdapter.java:351)
    03-23 12:35:57.834 I/MonoDroid( 6825): at com.telerik.widget.list.ListViewDataSourceAdapter.getItemId(ListViewDataSourceAdapter.java:396)
    03-23 12:35:57.834 I/MonoDroid( 6825): at com.telerik.widget.list.ListViewWrapperAdapter.getItemId(ListViewWrapperAdapter.java:413)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4667)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4617)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1994)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1390)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1353)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:574)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3028)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2906)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3283)
    03-23 12:35:57.834 I/MonoDroid( 6825): at com.telerik.widget.list.RadListView.onLayout(RadListView.java:561)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.view.View.layout(View.java:16630)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.view.ViewGroup.layout(ViewGroup.java:5437)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.view.View.layout(View.java:16630)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.view.ViewGroup.layout(ViewGroup.java:5437)
    03-23 12:35:57.834 I/MonoDroid( 6825): at md5b60ffeb829f638581ab2bb9b1a7f4f3f.ViewRenderer_2.n_onLayout(Native Method)
    03-23 12:35:57.834 I/MonoDroid( 6825): at md5b60ffeb829f638581ab2bb9b1a7f4f3f.ViewRenderer_2.onLayout(ViewRenderer_2.java:47)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.view.View.layout(View.java:16630)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.view.ViewGroup.layout(ViewGroup.java:5437)
    03-23 12:35:57.834 I/MonoDroid( 6825): at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
    03-23 12:35:57.834 I/MonoDroid( 6825): at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.n_onLayout(Native Method)
    03-23 12:35:57.834 I/MonoDroid( 6825): at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.onLayout(VisualElementRenderer_1.java:49)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.view.View.layout(View.java:16630)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.view.ViewGroup.layout(ViewGroup.java:5437)
    03-23 12:35:57.834 I/MonoDroid( 6825): at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
    03-23 12:35:57.834 I/MonoDroid( 6825): at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.n_onLayout(Native Method)
    03-23 12:35:57.834 I/MonoDroid( 6825): at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.onLayout(VisualElementRenderer_1.java:49)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.view.View.layout(View.java:16630)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.view.ViewGroup.layout(ViewGroup.java:5437)
    03-23 12:35:57.834 I/MonoDroid( 6825): at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
    03-23 12:35:57.834 I/MonoDroid( 6825): at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.n_onLayout(Native Method)
    03-23 12:35:57.834 I/MonoDroid( 6825): at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.onLayout(VisualElementRenderer_1.java:49)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.view.View.layout(View.java:16630)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.view.ViewGroup.layout(ViewGroup.java:5437)
    03-23 12:35:57.834 I/MonoDroid( 6825): at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
    03-23 12:35:57.834 I/MonoDroid( 6825): at md5270abb39e60627f0f200893b490a1ade.NavigationPageRenderer.n_onLayout(Native Method)
    03-23 12:35:57.834 I/MonoDroid( 6825): at md5270abb39e60627f0f200893b490a1ade.NavigationPageRenderer.onLayout(NavigationPageRenderer.java:65)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.view.View.layout(View.java:16630)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.view.ViewGroup.layout(ViewGroup.java:5437)
    03-23 12:35:57.834 I/MonoDroid( 6825): at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
    03-23 12:35:57.834 I/MonoDroid( 6825): at md5270abb39e60627f0f200893b490a1ade.MasterDetailContainer.n_onLayout(Native Method)
    03-23 12:35:57.834 I/MonoDroid( 6825): at md5270abb39e60627f0f200893b490a1ade.MasterDetailContainer.onLayout(MasterDetailContainer.java:53)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.view.View.layout(View.java:16630)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.view.ViewGroup.layout(ViewGroup.java:5437)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1187)
    03-23 12:35:57.834 I/MonoDroid( 6825): at md5270abb39e60627f0f200893b490a1ade.MasterDetailPageRenderer.n_onLayout(Native Method)
    03-23 12:35:57.834 I/MonoDroid( 6825): at md5270abb39e60627f0f200893b490a1ade.MasterDetailPageRenderer.onLayout(MasterDetailPageRenderer.java:68)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.view.View.layout(View.java:16630)
    03-23 12:35:57.834 I/MonoDroid( 6825): at android.view.ViewGroup.layout(ViewGroup.java:5437)
    03-23 12:35:57.835 I/MonoDroid( 6825): at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.n_onLayout(Native Method)
    03-23 12:35:57.835 I/MonoDroid( 6825): at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.onLayout(PlatformRenderer.java:63)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.View.layout(View.java:16630)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.ViewGroup.layout(ViewGroup.java:5437)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.View.layout(View.java:16630)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.ViewGroup.layout(ViewGroup.java:5437)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.View.layout(View.java:16630)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.ViewGroup.layout(ViewGroup.java:5437)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.View.layout(View.java:16630)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.ViewGroup.layout(ViewGroup.java:5437)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.View.layout(View.java:16630)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.ViewGroup.layout(ViewGroup.java:5437)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.View.layout(View.java:16630)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.ViewGroup.layout(ViewGroup.java:5437)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
    03-23 12:35:57.835 I/MonoDroid( 6825): at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2678)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.View.layout(View.java:16630)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.ViewGroup.layout(ViewGroup.java:5437)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2171)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1931)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.Choreographer.doCallbacks(Choreographer.java:670)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.Choreographer.doFrame(Choreographer.java:606)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.os.Handler.handleCallback(Handler.java:739)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.os.Handler.dispatchMessage(Handler.java:95)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.os.Looper.loop(Looper.java:148)
    03-23 12:35:57.835 I/MonoDroid( 6825): at android.app.ActivityThread.main(ActivityThread.java:5417)
    03-23 12:35:57.835 I/MonoDroid( 6825): at java.lang.reflect.Method.invoke(Native Method)
    03-23 12:35:57.835 I/MonoDroid( 6825): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    03-23 12:35:57.835 I/MonoDroid( 6825): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

    initialising the FarmName property on Site fixes this as well.

     

  4. Aaron
    Aaron avatar
    9 posts
    Member since:
    Sep 2016

    Posted 26 Mar 2017 Link to this post

    Any update on this ?
  5. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 27 Mar 2017 Link to this post

    Hi Aaron,

    I can confirm that this is a bug in the control. We will aim to fix it for one of the upcoming builds. I am afraid there's no other workaround than using non-null values at the moment.

    I have updated your Telerik points.


    Best regards,
    Ves
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Namek
    Namek avatar
    7 posts
    Member since:
    Jul 2016

    Posted 21 Jun 2017 Link to this post

    Same for me at *2017.2.0614.234*.
  7. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    665 posts

    Posted 22 Jun 2017 Link to this post

    Hello Namek, Aaron,

    Indeed, we have applied a fix for Xamarin.Android, however, the issue can still be reproduced in a Xamarin.Forms approach. Actually, the issue affects iOS and UWP as well so we have logged a task of unifying the behavior for all platforms.

    As for the actual issue, you are experiencing, I have attached a sample with a workaround which you can apply at your end. Please have a look at the custom renderer where the CreateAdapter method is overridden so it returns a custom RadListViewDataSourceAdapter. Eventually, you can choose the name of the group where the null items will be located:

    public override void OnBindGroupHolder(ListViewHolder holder, object item)
           {
               XF.BindableObject cell = this.GetHeaderCell(holder, item);
                
               if (cell != null)
               {
                   if (cell.BindingContext != item)
                   {
                       cell.BindingContext = item;
                   }
               }
               else if (holder is ListViewTextHolder)
               {
                   if (item == null)
                   {
                       item = "Choose";
                   }
                   ((ListViewTextHolder)holder).TextView.Text = item.ToString();
               }
           }


    Regards,
    Stefan Nenchev
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  8. Namek
    Namek avatar
    7 posts
    Member since:
    Jul 2016

    Posted 27 Jun 2017 in reply to Stefan Nenchev Link to this post

    @Stefan Nenchev do you have such workaround for iOS also?
  9. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    665 posts

    Posted 29 Jun 2017 Link to this post

    Hi Namek,

    Unfortunately, using the same approach is not that straightforward in iOS as the logic is internally handled in the native control. 

    However, there is a much easier approach for achieving the behavior in iOS and Android which suggests using a DelegateGroupDescriptor instead of PropertyGroupDescriptor. Here is the change you can apply in the sample project:

    lv.GroupDescriptors.Add(new DelegateGroupDescriptor() { KeyExtractor = (s) => ((DataItem)s).Name ?? "[null]" });

    I hope it will be useful.

    Regards,
    Stefan Nenchev
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  10. Namysław
    Namysław avatar
    44 posts
    Member since:
    Jul 2017

    Posted 05 Jul 2017 Link to this post

    Btw - exact same issue, with **SortDescriptors** and **PropertySortDescriptor** - nullable properties gives me same exception.
  11. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    665 posts

    Posted 06 Jul 2017 Link to this post

    Hello Namek,

    Analogically to the DelegateGroupDescriptor, you can use the DelegateSortDescriptor and DelegateFilterDescriptor for the other data operations:

    lv.SortDescriptors.Add(new DelegateSortDescriptor() { Comparer = (a, b) => (a as DataItem).Name.CompareTo((b as DataItem).Name), SortOrder = SortOrder.Ascending });
    lv.FilterDescriptors.Add(new DelegateFilterDescriptor() { Filter = (s) => FilteringMethod(s as DataItem)});
     
    private bool FilteringMethod(DataItem dataItem)
            {
                if (dataItem.Name != null)
                {
                    if (dataItem.Name == "Name 1")
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
                return false;
    }

    We will consider handling the scenario when using the different property descriptors.

    Regards,
    Stefan Nenchev
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  12. Namysław
    Namysław avatar
    44 posts
    Member since:
    Jul 2017

    Posted 06 Jul 2017 Link to this post

    I've already found similar workaround for that:


    List?.SortDescriptors?.Add(new DelegateSortDescriptor { Comparer = (o, o1) => Nullable.Compare(((MyObject)o).NullableDateProperty, ((MyObject)o1).NullableDateProperty), SortOrder = SortOrder.Descending });
Back to Top