Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Created attachment 15124 [details]
When you create a custom ViewCell which adds some elements to its View and that custom ViewCell uses a custom renderer in the Android project, then there will be a NullReferenceException after the custom renderers GetCellCore method successfully returned the cell.
The exception is raised here:
at Xamarin.Forms.Platform.Android.ConditionalFocusLayout.ApplyTouchListenersToSpecialCells (Xamarin.Forms.Cell item) [0x0008f] in <filename unknown>:0
at Xamarin.Forms.Platform.Android.TableViewModelRenderer.GetView (Int32 position, Android.Views.View convertView, Android.Views.ViewGroup parent) [0x00153] in <filename unknown>:0
at Android.Widget.BaseAdapter.n_GetView_ILandroid_view_View_Landroid_view_ViewGroup_ (IntPtr jnienv, IntPtr native__this, Int32 position, IntPtr native_convertView, IntPtr native_parent) [0x0001a] in /Users/builder/data/lanes/2692/e98e9627/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Widget.BaseAdapter.cs:509
at (wrapper dynamic-method) System.Object:8ed84031-e813-4601-b703-371118af0f60 (intptr,intptr,int,intptr,intptr)
The bug can be reproduced with the attached project which uses XF 2.1.0-pre4.
You can work around this bug when you do not assign anything to the custom ViewCells View property or do not call InitializeComponent if you defined it in xaml.
This bug is a duplicate of bug #29210. That bug has been created on 2015-04-17 for XF 1.4.1 and set to resolved fixed by Rui Marinho on 2015-06-03. But as several others pointed out afterwards, the bug is not fixed. I asked Rui and Anubhav Ranjan (who created it) to reopen 29210, but they did not respond. So I created a duplicate where I can control the status.
We have the same issiue - looks like the a null comparison is missing in that method.
It should be easy and fast to fix and we really need this.
Or a workaround.
i tried workaround mentioned at http://forums.xamarin.com/discussion/comment/110003/#Comment_110003
and it worked for me
"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."
I have checked this issue with Xamarin.Forms 18.104.22.168-pre1 and observed that this issue has been fixed.
Hence closing this issue.