RadListView renderer throws NullReferenceException on device but not simulator

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

    Posted 15 Jan Link to this post

    Hi there,

    I'm struggling to get the ListView working on my iOS devices. On the simulator these work fine, but on the devices i keep getting this error;

    NullReferenceException: Object reference not set to an instance of an object

    on the following line in my Main.cs file (same as the default xamarin one);

    UIApplication.Main(args, null, "AppDelegate");

    here's the stack trace

    at Telerik.XamarinForms.DataControlsRenderer.iOS.ListView.UIListViewCell.UpdateSelectionViewStyle () [0x000b5] in <69c148d17a40435da18b2f1c1ff180c5>:0
    at Telerik.XamarinForms.DataControlsRenderer.iOS.ListView.UIListViewCell.UpdateCell (Telerik.XamarinForms.DataControls.RadListView owner, System.Object dataItem) [0x0005a] in <69c148d17a40435da18b2f1c1ff180c5>:0
    at Telerik.XamarinForms.DataControlsRenderer.iOS.ListViewDataSource.InitCell (TelerikUI.TKListView listView, Foundation.NSIndexPath indexPath, TelerikUI.TKListViewCell tkCell, Foundation.NSObject obj) [0x000f5] in <69c148d17a40435da18b2f1c1ff180c5>:0
    at ObjCRuntime.Trampolines+SDActionArity4V1.Invoke (System.IntPtr block, System.IntPtr arg1, System.IntPtr arg2, System.IntPtr arg3, System.IntPtr arg4) [0x00033] in <9e260fcc0dbf47638fe447f503155067>:0
    at (wrapper native-to-managed) ObjCRuntime.Trampolines+SDActionArity4V1:Invoke (intptr,intptr,intptr,intptr,intptr)
  2. Aaron
    Aaron avatar
    9 posts
    Member since:
    Sep 2016

    Posted 15 Jan in reply to Aaron Link to this post

    further investigations; i can create a RadListView in XAML like so; and this works...

    <dataControls:RadListView x:Name="customerListView"     BackgroundColor="White"                             IsPullToRefreshEnabled="True">

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

    Posted 15 Jan Link to this post

    Adding ItemsSource causes my application to crash as soon as the page starts to load....

     

    <dataControls:RadListView x:Name="customerListView"
                                      ItemsSource="{Binding CustomerList}"
                                      BackgroundColor="White"
                                      IsPullToRefreshEnabled="True">

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

    Posted 15 Jan Link to this post

    Thrown Exception

    stack trace

     

    I can replicate this in my local development environment. For whatever reason as soon as I ask it to render (set ItemsSource) something it crashes with that error..

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

    Posted 15 Jan Link to this post

    https://slack-files.com/T06BQEKFZ-F3SHE5P7Z-a36f387da2

    https://slack-files.com/T06BQEKFZ-F3RSHPD6W-6672946e91

     

    this happens as soon as I set the ItemsSource property to something, and it tries to render a cell. If I dont set ItemsSource I can see the list view (i.e. i can pull down to refresh). Looks like a bug in the renderer code...

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

    Posted 15 Jan Link to this post

    https://slack-files.com/T06BQEKFZ-F3RSHPD6W-6672946e91

    https://slack-files.com/T06BQEKFZ-F3SHE5P7Z-a36f387da2

  7. Tsvyatko
    Admin
    Tsvyatko avatar
    857 posts

    Posted 16 Jan Link to this post

    Hello Aaron,

    Thank you for contacting us! The reported issue seems to be related to a specific setting in debug build. You can try to uncheck incremental builds setting in project properties. Currently, mono has trouble loading all custom types when this setting is set. We are working to pinpoint and workaround the issue however it seems like a mono framework limitation.

    We will update our documentation with troubleshooting article shortly as well as throw more meaningful exception.

    Please, excuse us for the inconvenience caused.

    Regards,
    Tsvyatko
    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
  8. Sascha
    Sascha avatar
    13 posts
    Member since:
    Jan 2017

    Posted 28 Jan Link to this post

    I had a similar NullReference exception, but not as detailed as the one posted here. But as suggested, building in release mode fixed it for me. Thanks for the hint.
Back to Top