Bug 29210

Summary: Xamarin Android failing to render ViewCell for list view in 1.4.1.6347
Product: Forms Reporter: Anubhav Ranjan <anubhav>
Component: FormsAssignee: Rui Marinho <rui.marinho>
Status: RESOLVED FIXED    
Severity: critical CC: acastro, caanmee, chris.king, colby.williams, daniel.roberts, daniel.tallentire, dima.am, eric.maupin, iitr.ankur, jas, john.miller, josueyeray, martinosgathorpe, michael, rui.marinho, rwagh, seth.rosetter, spencer.montgomery, sunilk
Priority: High    
Version: 1.4.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Tags: android crash customrenderer ac Is this bug a regression?: ---
Last known good build:
Attachments: repro project

Description Anubhav Ranjan 2015-04-17 14:17:49 UTC
Our customer is facing issues with Xamarin.Android failing to render ViewCell for ListView using Forms 1.4.1.6347


#Description:
==========
We have encountered an issue with our development for Android where the ViewCell Renderer will fail to process inflated layouts in 1.4.1.6347-pre2. In short the layout will inflate and can be adjusted with our data for each field (Basically 3 TextViews and an ImageView) but then crashes once this layout is returned back through the overridden procedure protected override View GetCellCore(Cell item, View convertView, ViewGroup parent, Context context). This has also been experienced by other developers after searching on the forum it would seem.

It has seriously impacted our development as we were due to release our first version of a chat application to google play store. Rolling back to previous revisions of our source code (with 1.3.4.6331-pre4) does compile and work fine however there would be significant development time to get this old revision back up to current - time we really don't have. Please can you contact me urgently to work to resolve this quickly as I'm quite sure this will be affecting many others very quickly. I have included the snippet of code for you so you can see what is being done.

The section of XAML in the view that populates the viewcel with data from the viewmodel....

<ctrls:ChatListView x:Name="lvwChats" VerticalOptions="FillAndExpand" ItemsSource="{Binding CurrentChatLines}" >
<ListView.ItemTemplate>
<DataTemplate>
<ctrls:MessageViewCell>
<ctrls:MessageViewCell.View>
<StackLayout Orientation="Horizontal">
<Image x:Name="userIcon" Source="{Binding ImageUrl, Converter={StaticResource cnvStrToImgSrc}}" WidthRequest="32" HeightRequest="32" />
<StackLayout Orientation="Horizontal">
<Label x:Name="lblSender" Text="{Binding OperatorName, StringFormat='{0}: '}}" FontSize="9" FontAttributes="Bold"/>
<Label x:Name="lblMessage" Text="{Binding Text}" FontSize="9" />
<Label x:Name="lblTimestamp" Text="{Binding Dated, StringFormat='{0:HH:mm}'}" FontSize="8"/>
</StackLayout>
</StackLayout>
</ctrls:MessageViewCell.View>
</ctrls:MessageViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ctrls:ChatListView>

The custom viewcell ....

public class MessageViewCell : ViewCell
{
}

The renderer ....

public class MessageRenderer : ViewCellRenderer
{
protected override View GetCellCore(Cell item, View convertView, ViewGroup parent, Context context)
{
// Get the inflator service
var inflatorservice = (LayoutInflater)Forms.Context.GetSystemService(Android.Content.Context.LayoutInflaterService);
// Fetch the data passed in by the viewcell (basically a ViewCell called MessageViewCell)
var chatLine = item.BindingContext as ChatLine;
// Generate a timestamp for this cell (Chat bubble)
string timeStamp = DateTime.Now.ToString("HH:mm:ss");

if (chatLine != null)
{
int layoutResource = -1;
// Select the bubble type to display.
switch(chatLine.ChatBubbleType)
{
case ChatLine.ChatBubbleTypes.Operator:
{
layoutResource = Resource.Layout.image_item_operator;
break;
}
case ChatLine.ChatBubbleTypes.Visitor:
{
layoutResource = Resource.Layout.image_item_visitor;
break;
}
case ChatLine.ChatBubbleTypes.StatusMsg:
{
layoutResource = Resource.Layout.image_item_status;
break;
}
}
// Process the selected layout with the required data and then display it in the listview.
var template = (LinearLayout)inflatorservice.Inflate(layoutResource, null, false);
template.FindViewById<TextView>(Resource.Id.nick).Text = chatLine.OperatorName + ":";
template.FindViewById<TextView>(Resource.Id.timestamp).Text = timeStamp;
template.FindViewById<ImageView>(Resource.Id.userimage).SetImageBitmap(GetImageBitmapFromUrl(chatLine.ImageUrl));
template.FindViewById<TextView>(Resource.Id.message).Text = chatLine.Text;

return template; // We crash here as it is passed back to add to the listview - now that the layout has been adjusted.
}

return base.GetCellCore(item, convertView, parent, context);
}

private Bitmap GetImageBitmapFromUrl(string url)
{
Bitmap imageBitmap = null;
using (var webClient = new WebClient())
{
var imageBytes = webClient.DownloadData(url);
if (imageBytes != null && imageBytes.Length > 0)
{
imageBitmap = BitmapFactory.DecodeByteArray(imageBytes, 0, imageBytes.Length);
}
}
return imageBitmap;
}

protected override void OnCellPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnCellPropertyChanged(sender, e);
}
}


#Version Information:
================
Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional

Visual Basic 2013 06177-004-0446016-02605
Microsoft Visual Basic 2013

Visual C# 2013 06177-004-0446016-02605
Microsoft Visual C# 2013

Windows Phone SDK 8.0 - ENU 06177-004-0446016-02605
Windows Phone SDK 8.0 - ENU

Xamarin 3.9.523.0 (d58edc4)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android 4.20.0.38 (38ac51a9d0866c7726a7484d82632c82c8221594)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS 8.8.1.0 (61fa2c6e0f2ef51eb98b8810de13b4469f379cc7)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration 1.0
Automated migration for Xamarin iOS Classic projects to Unified
Comment 2 Andres Castro 2015-04-28 16:46:09 UTC
Also experiencing this bug on 1.4.2.6355, has anyone found a work around yet? or is there any update on fixing this?

You should be able to see the error by running https://github.com/xamarin/xamarin-forms-samples/tree/master/WorkingWithListviewNative and clicking on the C tab. There is an open issue https://github.com/xamarin/xamarin-forms-samples/issues/53.
Comment 3 Sunil Kumar 2015-04-30 09:13:29 UTC
I have tried to reproduce this issue with the help of sample downloaded from url mentioned in comment1 and getting the same issue. Xamarin Android failing to render ViewCell for list view and it throws exception.

Screencast: http://www.screencast.com/t/Rl1VFuV8
Application Output: https://gist.github.com/sunil360/94049b1005a722e34743
IDE log: https://gist.github.com/sunil360/0ead39dcbf8b832580d4

Environment info:
Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.51641


Xamarin   3.11.487.0 (f6bd7eb)
Xamarin.Android   5.1.0.115 (d23da369e436488f38c8ab8fe8a9ae7d9ea5256b)
Xamarin.iOS   8.10.0.0 (7741cc495ab0baf04ff0405d0604bc27f0ecae2e)
Comment 4 Ankur 2015-05-04 03:42:26 UTC
Adding relevant forums link where this is discussed: http://forums.xamarin.com/discussion/comment/117786/#Comment_117786

Hope it might help in debug. Can you please confirm if the issue discussed in the forum is due to this bug or not? 

Thanks!!
Comment 6 Daniel Roberts 2015-05-21 05:47:49 UTC
This issue stopped occurring for me when I upgraded my project to 1.4.3.6356-Pre1 but has come back in 1.4.3.6358-Pre2. Tested in the sample project at https://github.com/xamarin/xamarin-forms-samples/tree/master/WorkingWithListviewNative and issue occurs there also. 

Any time line on fixing this?
Comment 7 Martin Osgathorpe 2015-05-27 08:15:47 UTC
This is a bug that I raised some time ago and was added by Anubhav Ranjan after my conversations with him and still there seems to be no fix! 

I have had it working on some previous versions of Xamarin Forms but since a recent update to Xamarin for Visual Studio - no version from 1.4.1.6349 (which did work) to the pre-release mentioned by Daniel Roberts works at all. 

The application I have been developing is business critical to my company - we have customers waiting to trial this application (already on Google Play in Beta plus Windows Store and Apple App Store) and at present we cannot give the trial to them because of the unreliability of Xamarin and moreover Xamarin Forms.

As I am the original person who raised this bug and the fact that you keep on fixing it in one side then breaking it somewhere else - isn't it now time you fixed this in ALL areas of your software tools with the utmost urgency so that all Xamarin developers can get their projects stable. At present, even your own samples won't actually work with regards to listview rendering! In my book that's a bit embarrassing for you.

I am considering now looking at other tools and re-writing our applications dispensing with Xamarin as a whole unless a solution to these kind of problems is found quickly.
Comment 8 Daniel Tallentire 2015-05-28 04:09:02 UTC
Any work-arounds or updates for this?
Comment 9 Daniel Roberts 2015-05-28 04:23:53 UTC
If you are desperate try and get hold of a copy of Xamarin.Forms 1.4.3.6356-Pre1. There is an add on tool for Xamarin Studio which lets you manually set the release version of a nuget package. You specify the version in the search bar (strangely) and should be able to set it to 1.4.3.6356-Pre1. The tool is in alpha and you would be using a unsupported version of Xamarin Forms.

In the mean time I have given up a nice feature that took 4 days to build. Not ideal, and has made me question the general wisdom of adding the Xamarin layer on top of the native platforms.
Comment 10 Martin Osgathorpe 2015-05-28 09:47:32 UTC
Just to update, I have recently re-tried our android code with 1.4.3.6356-Pre1 and found it to still break at the rendering point with the same issues as before. I then tried the Xamarin example app at
https://github.com/xamarin/xamarin-forms-samples/tree/master/WorkingWithListviewNative again with 1.4.3.6356-Pre1 as Daniel Roberts did and found this to work. As my code is slightly different, I copied the code from the sample project in GetCellCore and reworked it to use my data values and layouts. The project still crashed as before.

The main clue would seem to be that there are a number of reported 'Null References' as though the changed layout is not compilable by android.

Please, please, please can we get this to the top of the list of urgent fix required.

Many thanks.
Comment 11 Rui Marinho 2015-06-03 12:48:00 UTC
This seems fixed in 1.4.2-pre2 , do you mind test to see if you still have problems and reopen this bug if something doesn't work. 

Thanks
Warm Regards
Xamarin Forms Team
Comment 12 John Miller [MSFT] 2015-06-03 16:50:25 UTC
The fix mentioned in Comment #11 should be version 1.4.3-pre2.
Comment 13 Martin Osgathorpe 2015-06-08 12:50:59 UTC
I have tried the suggested version (1.4.3-pre2) today and the error is still present. Here is the crash information from Visual Studio, hopefully it will shed a little light on the problem.

06-08 17:45:38.514 I/MonoDroid(31917): UNHANDLED EXCEPTION:
06-08 17:45:38.514 I/MonoDroid(31917): System.NullReferenceException: Object reference not set to an instance of an object
06-08 17:45:38.514 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.ListViewAdapter.GetView (int,Android.Views.View,Android.Views.ViewGroup) <IL 0x002b8, 0x017d4>
06-08 17:45:38.514 I/MonoDroid(31917): at Android.Widget.BaseAdapter.n_GetView_ILandroid_view_View_Landroid_view_ViewGroup_ (intptr,intptr,int,intptr,intptr) [0x0001a] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Widget.BaseAdapter.cs:509
06-08 17:45:38.514 I/MonoDroid(31917): at (wrapper dynamic-method) object.99c12364-ae99-4070-adb7-5ae55e79ecc4 (intptr,intptr,int,intptr,intptr) <IL 0x00023, 0x00063>
06-08 17:45:38.534 I/MonoDroid(31917): UNHANDLED EXCEPTION:
06-08 17:45:38.534 I/MonoDroid(31917): System.NullReferenceException: Object reference not set to an instance of an object
06-08 17:45:38.534 I/MonoDroid(31917): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61
06-08 17:45:38.534 I/MonoDroid(31917): at Android.Runtime.JNIEnv.CallVoidMethod (intptr,intptr,Android.Runtime.JValue*) [0x00063] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:571
06-08 17:45:38.534 I/MonoDroid(31917): at Android.Views.ViewGroup.Layout (int,int,int,int) [0x00082] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Views.ViewGroup.cs:3760
06-08 17:45:38.534 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.ViewRenderer`2<Xamarin.Forms.ListView, Android.Widget.ListView>.OnLayout (bool,int,int,int,int) <0x0025b>
06-08 17:45:38.534 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.ListViewRenderer.OnLayout (bool,int,int,int,int) <IL 0x00008, 0x0008f>
06-08 17:45:38.534 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.FormsViewGroup.n_OnLayout_ZIIII (intptr,intptr,bool,int,int,int,int) <IL 0x00012, 0x000f7>
06-08 17:45:38.534 I/MonoDroid(31917): at (wrapper dynamic-method) object.3e28543e-d11c-40a3-8849-080cd20b4f62 (intptr,intptr,bool,int,int,int,int) <IL 0x0002f, 0x00093>
06-08 17:45:38.534 I/MonoDroid(31917): UNHANDLED EXCEPTION:
06-08 17:45:38.534 I/MonoDroid(31917): System.NullReferenceException: Object reference not set to an instance of an object
06-08 17:45:38.534 I/MonoDroid(31917): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61
06-08 17:45:38.534 I/MonoDroid(31917): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue*) [0x00084] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1029
06-08 17:45:38.534 I/MonoDroid(31917): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) [0x0001d] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1036
06-08 17:45:38.534 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.FormsViewGroup.MeasureAndLayout (int,int,int,int,int,int) <IL 0x00160, 0x009c3>
06-08 17:45:38.534 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.VisualElementTracker.UpdateLayout () <IL 0x000c6, 0x00547>
06-08 17:45:38.534 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.ListView>.UpdateLayout () <0x0006f>
06-08 17:45:38.534 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.OnLayout (bool,int,int,int,int) <0x001ff>
06-08 17:45:38.534 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.FormsViewGroup.n_OnLayout_ZIIII (intptr,intptr,bool,int,int,int,int) <IL 0x00012, 0x000f7>
06-08 17:45:38.554 I/MonoDroid(31917): at (wrapper dynamic-method) object.3e28543e-d11c-40a3-8849-080cd206-08 17:45:38.534 I/MonoDroid(31917): at (wrapper dynamic-method) object.3e28543e-d11c-40a3-8849-080cd20b4f62 (intptr,intptr,bool,int,int,int,int) <IL 0x0002f, 0x00093>
06-08 17:45:38.544 I/MonoDroid(31917): UNHANDLED EXCEPTION:
06-08 17:45:38.544 I/MonoDroid(31917): System.NullReferenceException: Object reference not set to an instance of an object
06-08 17:45:38.544 I/MonoDroid(31917): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61
06-08 17:45:38.544 I/MonoDroid(31917): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue*) [0x00084] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1029
06-08 17:45:38.544 I/MonoDroid(31917): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) [0x0001d] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1036
06-08 17:45:38.544 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.FormsViewGroup.MeasureAndLayout (int,int,int,int,int,int) <IL 0x00160, 0x009c3>
06-08 17:45:38.544 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.VisualElementTracker.UpdateLayout () <IL 0x000c6, 0x00547>
06-08 17:45:38.544 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.UpdateLayout () <0x0006f>
06-08 17:45:38.544 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.ScrollViewContainer.OnLayout (bool,int,int,int,int) <IL 0x00016, 0x000e3>
06-08 17:45:38.544 I/MonoDroid(31917): at Android.Views.ViewGroup.n_OnLayout_ZIIII (intptr,intptr,bool,int,int,int,int) [0x00009] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Views.ViewGroup.cs:4041
06-08 17:45:38.544 I/MonoDroid(31917): at (wrapper dynamic-method) object.d110708d-0f21-4222-a7e8-c6517eadbba4 (intptr,intptr,bool,int,int,int,int) <IL 0x0002f, 0x00093>
06-08 17:45:38.544 I/MonoDroid(31917): UNHANDLED EXCEPTION:
06-08 17:45:38.544 I/MonoDroid(31917): System.NullReferenceException: Object reference not set to an instance of an object
06-08 17:45:38.544 I/MonoDroid(31917): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61
An unhandled exception occured.

06-08 17:45:38.544 I/MonoDroid(31917): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue*) [0x00084] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1029
06-08 17:45:38.544 I/MonoDroid(31917): at Android.Widget.FrameLayout.OnLayout (bool,int,int,int,int) [0x000c4] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Widget.FrameLayout.cs:725
06-08 17:45:38.544 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.ScrollViewRenderer.OnLayout (bool,int,int,int,int) <IL 0x00008, 0x0008f>
06-08 17:45:38.544 I/MonoDroid(31917): at Android.Widget.FrameLayout.n_OnLayout_ZIIII (intptr,intptr,bool,int,int,int,int) [0x00009] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Widget.FrameLayout.cs:703
06-08 17:45:38.544 I/MonoDroid(31917): at (wrapper dynamic-method) object.eb9617da-55e0-43e9-93e4-8378d0c95627 (intptr,intptr,bool,int,int,int,int) <IL 0x0002f, 0x00093>
06-08 17:45:38.544 I/MonoDroid(31917): UNHANDLED EXCEPTION:
06-08 17:45:38.544 I/MonoDroid(31917): System.NullReferenceException: Object reference not set to an instance of an object
06-08 17:45:38.544 I/MonoDroid(31917): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61
06-08 17:45:38.544 I/MonoDroid(31917): at Android.Runtime.JNIEnv.CallVoidMethod (intptr,intptr,Android.Runtime.JValue*) [0x00063] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:571
06-08 17:45:38.544 I/MonoDroid(31917): at Android.Views.ViewGroup.Layout (int,int,int,int) [0x00082] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Views.ViewGroup.cs:3760
06-08 17:45:38.544 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.VisualElementTracker.UpdateLayout () <IL 0x0009b, 0x00463>
06-08 17:45:38.544 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.ScrollViewRenderer.UpdateLayout () <IL 0x0000e, 0x0006f>
06-08 17:45:38.544 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.Page>.OnLayout (bool,int,int,int,int) <0x001ff>
06-08 17:45:38.544 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.FormsViewGroup.n_OnLayout_ZIIII (intptr,intptr,bool,int,int,int,int) <IL 0x00012, 0x000f7>
06-08 17:45:38.544 I/MonoDroid(31917): at (wrapper dynamic-method) object.3e28543e-d11c-40a3-8849-080cd20b4f62 (intptr,intptr,bool,int,int,int,int) <IL 0x0002f, 0x00093>
06-08 17:45:38.554 I/MonoDroid(31917): UNHANDLED EXCEPTION:
06-08 17:45:38.554 I/MonoDroid(31917): System.NullReferenceException: Object reference not set to an instance of an object
06-08 17:45:38.554 I/MonoDroid(31917): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61
06-08 17:45:38.554 I/MonoDroid(31917): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue*) [0x00084] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1029
06-08 17:45:38.554 I/MonoDroid(31917): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) [0x0001d] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1036
06-08 17:45:38.554 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.FormsViewGroup.MeasureAndLayout (int,int,int,int,int,int) <IL 0x00160, 0x009c3>
06-08 17:45:38.554 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.VisualElementTracker.UpdateLayout () <IL 0x000c6, 0x00547>
06-08 17:45:38.554 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.Page>.UpdateLayout () <0x0006f>
06-08 17:45:38.554 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.NavigationPage>.OnLayout (bool,int,int,int,int) <0x001ff>
06-08 17:45:38.554 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.NavigationRenderer.OnLayout (bool,int,int,int,int) <IL 0x00008, 0x00093>
06-08 17:45:38.554 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.FormsViewGroup.n_OnLayout_ZIIII (intptr,intptr,bool,int,int,int,int) <IL 0x00012, 0x000f7>
06-08 17:45:38.554 I/MonoDroid(31917): at (wrapper dynamic-method) object.3e28543e-d11c-40a3-8849-080cd20b4f62 (intptr,intptr,bool,int,int,int,int) <IL 0x0002f, 0x00093>
06-08 17:45:38.554 I/MonoDroid(31917): UNHANDLED EXCEPTION:
06-08 17:45:38.554 I/MonoDroid(31917): System.NullReferenceException: Object reference not set to an instance of an object
06-08 17:45:38.554 I/MonoDroid(31917): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61
06-08 17:45:38.554 I/MonoDroid(31917): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue*) [0x00084] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1029
06-08 17:45:38.554 I/MonoDroid(31917): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) [0x0001d] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1036
06-08 17:45:38.554 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.FormsViewGroup.MeasureAndLayout (int,int,int,int,int,int) <IL 0x00160, 0x009c3>
06-08 17:45:38.554 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.VisualElementTracker.UpdateLayout () <IL 0x000c6, 0x00547>
06-08 17:45:38.554 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.NavigationPage>.UpdateLayout () <0x0006f>
06-08 17:45:38.554 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.Platform.OnLayout (bool,int,int,int,int) <IL 0x000a0, 0x00653>
06-08 17:45:38.554 I/MonoDroid(31917): at Xamarin.Forms.Platform.Android.PlatformRenderer.OnLayout (bool,int,int,int,int) <IL 0x0001b, 0x000e3>
06-08 17:45:38.554 I/MonoDroid(31917): at Android.Views.ViewGroup.n_OnLayout_ZIIII (intptr,intptr,bool,int,int,int,int) [0x00009] in /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d419c934/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Views.ViewGroup.cs:4041
06-08 17:45:38.554 I/MonoDroid(31917): at (wrapper dynamic-method) object.d110708d-0f21-4222-a7e8-c6517eadbba4 (intptr,intptr,bool,int,int,int,int) <IL 0x0002f, 0x00093>
06-08 17:45:38.554 D/AndroidRuntime(31917): Shutting down VM
06-08 17:45:38.554 W/dalvikvm(31917): threadid=1: thread exiting with uncaught exception (group=0x41c24da0)

This is certainly NOT fixed as you suggest.

Thanks.
Comment 14 Andres Castro 2015-06-08 13:07:17 UTC
I was able to get around the issue by doing "Device.OnPlatform (InitializeComponent);" The issue is that if you have xaml defined and you just want to override Android you can't initialize the component.
Comment 15 Martin Osgathorpe 2015-06-10 12:27:53 UTC
I have tried the Device.OnPlatform() suggestion from Andres Castro but sadly that doesn't work either. It does allow the form to load but with no intialization there will be no controls. So I am still at 1st base with this at present. Xamarin - can you please test this out with my example code I sent to you, or let me know if that is what you used to test already? I'm pretty sure you will reproduce this in the end - it is definitely there.
Comment 16 Martin Osgathorpe 2015-06-15 08:59:34 UTC
I am posting a video of what happens when I run our app in relation to this crash to see if there is anyone who can shed some light on the problem. I have tried everything else and we are now running out of time.

http://1drv.ms/1fcrcaO

Thanks.
Comment 17 Caan Mee 2015-06-28 13:32:40 UTC
The issue has a "Resolved Fixed" status, but using the latest Xamarin.Forms 1.4.3 -pre3 it is still present.

So in which version should it be fixed?
Comment 18 Josue Yeray 2015-07-06 11:11:47 UTC
I also have this bug in one client app i am developing. Is this going to be fixed any time??
Comment 19 Ankur 2015-07-07 01:57:27 UTC
Update and try Xamarin.Forms 1.4.3.6374 version. I don't get this issue with this version.
Comment 20 Dmitry Moiseev 2016-01-21 07:51:55 UTC
I already get this bug on Xamarin.Forms 2.0.0.6490

Class for recreate bug:
[assembly: ExportRenderer(typeof (XSwipeableCell), typeof (SwipeableCellRenderer))]

    public class SwipeableCellRenderer: ViewCellRenderer
    {
        protected override View GetCellCore(Cell item, View nativeCellView, ViewGroup parent, Context context)
        {
            return new TextView(context);
        }
    }

Output log:

01-21 02:48:53.165 I/MonoDroid( 2214): UNHANDLED EXCEPTION:
01-21 02:48:53.165 I/MonoDroid( 2214): System.NullReferenceException: Object reference not set to an instance of an object
01-21 02:48:53.165 I/MonoDroid( 2214):   at (wrapper dynamic-method) System.Object:ce93815e-ff29-490c-9ca4-ed1a94165664 (intptr,intptr,int,intptr,intptr)
01-21 02:48:53.165 I/MonoDroid( 2214):   at (wrapper native-to-managed) System.Object:ce93815e-ff29-490c-9ca4-ed1a94165664 (intptr,intptr,int,intptr,intptr)
01-21 02:48:53.165 I/MonoDroid( 2214):   at (wrapper managed-to-native) System.Object:wrapper_native_0xb4d4d610 (intptr,intptr,intptr,Android.Runtime.JValue*)
01-21 02:48:53.165 I/MonoDroid( 2214):   at Android.Runtime.JNIEnv.CallVoidMethod (IntPtr jobject, IntPtr jmethod, Android.Runtime.JValue* parms) [0x00040] in /Users/builder/data/lanes/2512/d3008455/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:567 
01-21 02:48:53.165 I/MonoDroid( 2214):   at Android.Views.ViewGroup.Layout (Int32 l, Int32 t, Int32 r, Int32 b) [0x00082] in /Users/builder/data/lanes/2512/d3008455/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Views.ViewGroup.cs:3763 
01-21 02:48:53.165 I/MonoDroid( 2214):   at Xamarin.Forms.Platform.Android.ViewRenderer`2[TView,TNativeView].OnLayout (Boolean changed, Int32 l, Int32 t, Int32 r, Int32 b) [0x00059] in <filename unknown>:0 
01-21 02:48:53.165 I/MonoDroid( 2214):   at Xamarin.Forms.Platform.Android.ListViewRenderer.OnLayout (Boolean changed, Int32 l, Int32 t, Int32 r, Int32 b) [0x00000] in <filename unknown>:0 
01-21 02:48:53.165 I/MonoDroid( 2214):   at Xamarin.Forms.Platform.Android.FormsViewGroup.n_OnLayout_ZIIII (IntPtr jnienv, IntPtr native__this, Boolean p0, Int32 p1, Int32 p2, Int32 p3, Int32 p4) [0x00008] in <filename unknown>:0 
01-21 02:48:53.165 I/MonoDroid( 2214):   at (wrapper dynamic-method) System.Object:bc754bc1-3739-4e00-9f4f-61ee6a6c20bb (intptr,intptr,bool,int,int,int,int)
01-21 02:48:53.165 W/dalvikvm( 2214): JNI WARNING: JNI function NewString called with exception pending
01-21 02:48:53.165 W/dalvikvm( 2214):              in Lmd5b60ffeb829f638581ab2bb9b1a7f4f3f/ListViewAdapter;.n_getView:(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View; (NewString)
01-21 02:48:53.165 W/dalvikvm( 2214): Pending exception is:
01-21 02:48:53.165 I/dalvikvm( 2214): md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object
01-21 02:48:53.165 I/dalvikvm( 2214):   at Xamarin.Forms.Platform.Android.ConditionalFocusLayout.ApplyTouchListenersToSpecialCells (Xamarin.Forms.Cell item) [0x0008f] in <filename unknown>:0 
01-21 02:48:53.165 I/dalvikvm( 2214):   at Xamarin.Forms.Platform.Android.ListViewAdapter.GetView (Int32 position, Android.Views.View convertView, Android.Views.ViewGroup parent) [0x002fb] in <filename unknown>:0 
01-21 02:48:53.165 I/dalvikvm( 2214):   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/2512/d3008455/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Widget.BaseAdapter.cs:509 
01-21 02:48:53.165 I/dalvikvm( 2214):   at (wrapper dynamic-method) System.Object:ce93815e-ff29-490c-9ca4-ed1a94165664 (intptr,intptr,int,intptr,intptr)
01-21 02:48:53.165 I/dalvikvm( 2214): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.ListViewAdapter.n_getView(Native Method)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.ListViewAdapter.getView(ListViewAdapter.java:59)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java:220)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at android.widget.AbsListView.obtainView(AbsListView.java:2263)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at android.widget.ListView.makeAndAddView(ListView.java:1790)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at android.widget.ListView.fillDown(ListView.java:691)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at android.widget.ListView.fillFromTop(ListView.java:752)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at android.widget.ListView.layoutChildren(ListView.java:1630)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at android.widget.AbsListView.onLayout(AbsListView.java:2091)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at android.view.View.layout(View.java:14817)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:581)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at android.view.View.layout(View.java:14817)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.ListViewRenderer.n_onLayout(Native Method)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.ListViewRenderer.onLayout(ListViewRenderer.java:64)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at android.view.View.layout(View.java:14817)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.n_onLayout(Native Method)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.onLayout(VisualElementRenderer_1.java:48)
01-21 02:48:53.175 I/dalvikvm( 2214): 	at android.view.View.layout(View.java:14817)
In mgmain JNI_OnLoad
01-21 02:48:53.175 I/dalvikvm( 2214): 	at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.n_onLayout(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.onLayout(VisualElementRenderer_1.java:48)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.n_onLayout(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.onLayout(VisualElementRenderer_1.java:48)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PageContainer.n_onLayout(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PageContainer.onLayout(PageContainer.java:61)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at md5270abb39e60627f0f200893b490a1ade.NavigationPageRenderer.n_onLayout(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at md5270abb39e60627f0f200893b490a1ade.NavigationPageRenderer.onLayout(NavigationPageRenderer.java:62)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.MasterDetailContainer.n_onLayout(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.MasterDetailContainer.onLayout(MasterDetailContainer.java:53)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1043)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at md5270abb39e60627f0f200893b490a1ade.MasterDetailPageRenderer.n_onLayout(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at md5270abb39e60627f0f200893b490a1ade.MasterDetailPageRenderer.onLayout(MasterDetailPageRenderer.java:67)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.n_onLayout(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.onLayout(PlatformRenderer.java:62)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1987)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1744)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.Choreographer.doCallbacks(Choreographer.java:574)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.Choreographer.doFrame(Choreographer.java:544)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.os.Handler.handleCallback(Handler.java:733)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.os.Handler.dispatchMessage(Handler.java:95)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.os.Looper.loop(Looper.java:136)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at android.app.ActivityThread.main(ActivityThread.java:5017)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at java.lang.reflect.Method.invokeNative(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at java.lang.reflect.Method.invoke(Method.java:515)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
01-21 02:48:53.185 I/dalvikvm( 2214): 	at dalvik.system.NativeStart.main(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214): "main" prio=5 tid=1 NATIVE
01-21 02:48:53.185 I/dalvikvm( 2214):   | group="main" sCount=0 dsCount=0 obj=0xb0d01bd8 self=0xb79124c0
01-21 02:48:53.185 I/dalvikvm( 2214):   | sysTid=2214 nice=0 sched=0/0 cgrp=apps handle=-1216941984
01-21 02:48:53.185 I/dalvikvm( 2214):   | state=R schedstat=( 0 0 0 ) utm=42 stm=192 core=0
01-21 02:48:53.185 I/dalvikvm( 2214):   #00  pc 000bd4c6  /system/lib/libdvm.so (dvmDumpNativeStack(DebugOutputTarget const*, int)+86)
01-21 02:48:53.185 I/dalvikvm( 2214):   #01  pc 000980a3  /system/lib/libdvm.so (dvmDumpThreadEx(DebugOutputTarget const*, Thread*, bool)+1155)
01-21 02:48:53.185 I/dalvikvm( 2214):   #02  pc 00098396  /system/lib/libdvm.so (dvmDumpThread(Thread*, bool)+86)
01-21 02:48:53.185 I/dalvikvm( 2214):   #03  pc 0004ce27  /system/lib/libdvm.so (ScopedCheck::checkThread(int)+455)
01-21 02:48:53.185 I/dalvikvm( 2214):   #04  pc 00052915  /system/lib/libdvm.so
01-21 02:48:53.185 I/dalvikvm( 2214):   #05  pc 00005eb7  <unknown>
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5b60ffeb829f638581ab2bb9b1a7f4f3f.ListViewAdapter.n_getView(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5b60ffeb829f638581ab2bb9b1a7f4f3f.ListViewAdapter.getView(ListViewAdapter.java:59)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java:220)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.AbsListView.obtainView(AbsListView.java:2263)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.ListView.makeAndAddView(ListView.java:1790)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.ListView.fillDown(ListView.java:691)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.ListView.fillFromTop(ListView.java:752)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.ListView.layoutChildren(ListView.java:1630)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.AbsListView.onLayout(AbsListView.java:2091)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:581)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5b60ffeb829f638581ab2bb9b1a7f4f3f.ListViewRenderer.n_onLayout(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5b60ffeb829f638581ab2bb9b1a7f4f3f.ListViewRenderer.onLayout(ListViewRenderer.java:64)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214):   at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.n_onLayout(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.onLayout(VisualElementRenderer_1.java:48)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214):   at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.n_onLayout(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.onLayout(VisualElementRenderer_1.java:48)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214):   at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.n_onLayout(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5b60ffeb829f638581ab2bb9b1a7f4f3f.VisualElementRenderer_1.onLayout(VisualElementRenderer_1.java:48)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214):   at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PageContainer.n_onLayout(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PageContainer.onLayout(PageContainer.java:61)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5270abb39e60627f0f200893b490a1ade.NavigationPageRenderer.n_onLayout(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5270abb39e60627f0f200893b490a1ade.NavigationPageRenderer.onLayout(NavigationPageRenderer.java:62)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214):   at com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout(FormsViewGroup.java:29)
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5b60ffeb829f638581ab2bb9b1a7f4f3f.MasterDetailContainer.n_onLayout(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5b60ffeb829f638581ab2bb9b1a7f4f3f.MasterDetailContainer.onLayout(MasterDetailContainer.java:53)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1043)
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5270abb39e60627f0f200893b490a1ade.MasterDetailPageRenderer.n_onLayout(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5270abb39e60627f0f200893b490a1ade.MasterDetailPageRenderer.onLayout(MasterDetailPageRenderer.java:67)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.n_onLayout(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214):   at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PlatformRenderer.onLayout(PlatformRenderer.java:62)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.View.layout(View.java:14817)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewGroup.layout(ViewGroup.java:4631)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1987)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1744)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.Choreographer.doCallbacks(Choreographer.java:574)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.Choreographer.doFrame(Choreographer.java:544)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.os.Handler.handleCallback(Handler.java:733)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.os.Handler.dispatchMessage(Handler.java:95)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.os.Looper.loop(Looper.java:136)
01-21 02:48:53.185 I/dalvikvm( 2214):   at android.app.ActivityThread.main(ActivityThread.java:5017)
01-21 02:48:53.185 I/dalvikvm( 2214):   at java.lang.reflect.Method.invokeNative(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214):   at java.lang.reflect.Method.invoke(Method.java:515)
01-21 02:48:53.185 I/dalvikvm( 2214):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
01-21 02:48:53.185 I/dalvikvm( 2214):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
01-21 02:48:53.185 I/dalvikvm( 2214):   at dalvik.system.NativeStart.main(Native Method)
01-21 02:48:53.185 I/dalvikvm( 2214): 
01-21 02:48:53.185 E/dalvikvm( 2214): VM aborting
01-21 02:48:53.185 F/libc    ( 2214): Fatal signal 6 (SIGABRT) at 0x000008a6 (code=-6), thread 2214 (tur_elba.extend)
01-21 02:48:53.205 W/Mono    ( 2214): The request to load the assembly System.Core v4.0.0.0 was remapped to v2.0.5.0
01-21 02:48:53.205 D/Mono    ( 2214): Unloading image System.Core.dll [0xb9fbc7a0].
01-21 02:48:53.205 D/Mono    ( 2214): Image addref System.Core[0xb9d16520] -> System.Core.dll[0xb7ce87e0]: 4
01-21 02:48:53.225 W/Mono    ( 2214): The request to load the assembly System.Core v4.0.0.0 was remapped to v2.0.5.0
01-21 02:48:53.225 D/Mono    ( 2214): Unloading image System.Core.dll [0xb9fba3e0].
01-21 02:48:53.225 D/Mono    ( 2214): Image addref System.Core[0xb9f6d360] -> System.Core.dll[0xb7ce87e0]: 5
Comment 21 Michael Rumpler 2016-02-11 17:57:31 UTC
I also fell over this with Xamarin.Forms 2.1.0.6508-pre3.

There's a NullReferenceException after my custom ViewCell renderer handed the inflated .axml back

StackTrace:
  at Xamarin.Forms.Platform.Android.ConditionalFocusLayout.ApplyTouchListenersToSpecialCells (Xamarin.Forms.Cell item) [0x0008f] in <filename unknown>:0 
  at Xamarin.Forms.Platform.Android.ListViewAdapter.GetView (Int32 position, Android.Views.View convertView, Android.Views.ViewGroup parent) [0x00305] 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:bf701a28-81a5-4054-9f5d-6c0f38fe3c11 (intptr,intptr,int,intptr,intptr)


My renderer is kept very simple just to demonstrate it:

		protected override global::Android.Views.View GetCellCore(Cell item, global::Android.Views.View convertView, ViewGroup parent, Context context)
		{
			var nativeView = convertView;

			if (nativeView == null)
				nativeView = (context as Activity).LayoutInflater.Inflate(Resource.Layout.DocNavigationCell, null);

			return nativeView;
		}

Inflate() did find the layout, so the renderer does return something. When I return from that method, then the exception occurs. The renderer is not called again although there are more cells in the list.
Comment 22 Michael Rumpler 2016-02-11 18:05:48 UTC
I should add that I'm using AppCompat. Maybe this is the reason.

In the WorkingWithListviewNative sample (which works for me with XF 2.1.0-pre4) this is not used.
Comment 23 Michael Rumpler 2016-02-11 20:57:51 UTC
Created attachment 15012 [details]
repro project

It is not because of AppCompat.

The attached sample project demonstrates the problem. It uses XF 2.1.0-pre4 without AppCompat.

I tested it on a Nexus 10 tablet with Android 5.1.1.
Comment 24 Michael Rumpler 2016-02-22 14:45:56 UTC
I asked bth Anubhav and Rui to reopen this bug, but got no response. So I created bug #38989.
Comment 25 rwagh 2016-03-21 10:28:54 UTC
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."