Possible bug in newer versions of xamarin forms listview

I'm not sure if it is a bug, or if I'm doing something wrong, but it seems that ViewCellRenderer has stopped working in all versions of xamarin forms after 1.3.5.6335. My entire project relies on custom viewcells, so that is kind of a problem. I made a simple project to reproduce the problem. It works with 1.3.5.6335 but not with 1.3.5.6337 or 1.4.0.6341 where it fails with error:

System.Diagnostics.Debugger.Mono_UnhandledException (ex={System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.Platform.Android.ListViewAdapter.GetView (int,Android.Views.View,Android.Views.ViewGroup)
at Android.Widget.BaseAdapter.n_GetView_ILandroid_view_View_Landroid_view_ViewGroup_ (intptr,intptr,int,intptr,intptr) [0x0001a] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/9e05e39f/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Widget.BaseAdapter.cs:460
at (wrapper dynamic-method) object.0e0073ff-03ab-48df-abc2-b71bed77fd41 (intptr,intptr,int,intptr,intptr)
})

Project can be found rarred at:

http://downloads.hylas.be/ListViewTest.rar

Posts

  • powerdudepowerdude USMember ✭✭

    you should post a bug at https:\bugzilla.xamarin.com.

  • TomStandaert.0575TomStandaert.0575 BEMember ✭✭

    I found out that calling the base function of GetCellCore before doing anything else resolves the problem. Must be something different in the newer versions of xamarin forms.

  • AndrewRobertsAndrewRoberts USMember ✭✭

    I resolved the issue by changing my ViewCells to derive from Cell and use CellRenderer. Of course, this requires all of your UI code to be in platform specific projects. Mine already was so it wasn't a big issue for me. If you're relying on Xam Forms for your layout then this approach would not work.

  • AnkurAnkur USMember ✭✭

    I too get this bug. It happens after returning from GetCellCore function to create a custom renderer. Also, as mentioned above, xamarin forms 1.3.5.6335 does not have this issue. I used this tool to revert back the Xamarin.Forms version: https://forums.xamarin.com/discussion/comment/64299/#Comment_64299

    Same issue is resulting in this xamarin-froms-sample bug: https://github.com/xamarin/xamarin-forms-samples/issues/53

    Stackt Trace:
    System.NullReferenceException: Object reference not set to an instance of an object
    at at Xamarin.Forms.Platform.Android.Platform.GetRenderer (Xamarin.Forms.BindableObject)
    at at Xamarin.Forms.Platform.Android.ListViewAdapter.GetView (int,Android.Views.View,Android.Views.ViewGroup)
    at Android.Widget.BaseAdapter.n_GetView_ILandroid_view_View_Landroid_view_ViewGroup_ (intptr,intptr,int,intptr,intptr) [0x0001a] in /Users/builder/data/lanes/1353/86274adf/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Widget.BaseAdapter.cs:460
    at at (wrapper dynamic-method) object.d4d4b28b-3b94-421f-93df-560a76046b95 (intptr,intptr,int,intptr,intptr)

  • AndresCastroAndresCastro USMember

    Looks like a bug was opened https://bugzilla.xamarin.com/show_bug.cgi?id=29210 but there hasn't been a response yet.

  • DanielRoberts.3517DanielRoberts.3517 USMember ✭✭

    Same issue here. Have spent quite a few hours trying to resolve. Unfortunately calling the base getcellcore didn't work for me. I had resolved it by using 1.4.3.6358 Pre-1 for just the Android project but it seems to be back in Pre 2.

  • DanielTallentireDanielTallentire GBMember

    We are still having this issue and currently haven't found any work-arounds.

  • BastiBrauningBastiBrauning USMember

    I'm still experiencing the issue with 1.4.3 -pre3, despite the Bugzilla Bug was set to fixed before the release.

    Does anyone have a working solution?

  • GeorgeCookGeorgeCook PEUniversity ✭✭✭

    I too hope they fix this as it blocks my renderer optimisations on android.

  • AnkurAnkur USMember ✭✭

    The bug: https://bugzilla.xamarin.com/show_bug.cgi?id=29210 is marked as fixed though there are comments that it is not. I haven't verified it yet. If anyone is blocked on this, request to verify it and re-open if necessary.

  • AlexStrongAlexStrong GBMember ✭✭

    I am getting this also where just by switching between different tabs on xamarin forms i eventually get an app crash with this error... ANY FIX AVAILABLE?

    System.NullReferenceException: Object reference not set to an instance of an object
    at Xamarin.Forms.Platform.iOS.Platform.GetRenderer (Xamarin.Forms.VisualElement bindable) [0x00000] in :0
    at Xamarin.Forms.Platform.iOS.NavigationRenderer.GetAppearedOrDisappearedTask (Xamarin.Forms.Page page) [0x00011] in :0
    at Xamarin.Forms.Platform.iOS.NavigationRenderer.RemoveViewControllers (Boolean animated) [0x00048] in :0
    at Xamarin.Forms.Platform.iOS.NavigationRenderer.PopToRootViewController (Boolean animated) [0x00008] in :0
    at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
    at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Users/builder/data/lanes/2377/73229919/source/maccore/src/UIKit/UIApplication.cs:77
    at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/2377/73229919/source/maccore/src/UIKit/UIApplication.cs:61
    at myapp.iOS.Application.Main (System.String[] args) [0x00009] in /Users/alexstrong/Projects/myappApp/iOS/Main.cs:18

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    I filed bug #38989 as it does not seem like bug #29210 will be reopened.

  • PhamThanhTongPhamThanhTong USMember ✭✭

    This issue was solved in package version: Xamarin Forms 2.3.4.184-pre1 https://www.nuget.org/packages/Xamarin.Forms/2.3.4.184-pre1

Sign In or Register to comment.