Bug 29761 - UNHANDLED EXCEPTION: 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)
Summary: UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set ...
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 1.4.3
Hardware: PC Windows
: High critical
Target Milestone: ---
Assignee: Rui Marinho
Depends on:
Reported: 2015-05-05 13:25 UTC by Jon Douglas [MSFT]
Modified: 2015-08-17 14:30 UTC (History)
9 users (show)

Tags: android crash xaml listview viewcell U7K AC
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:

Description Jon Douglas [MSFT] 2015-05-05 13:25:24 UTC

Unhandled Exception occurs when navigating to a page with a Native ListView and custom ViewCellRenderer. Previously this occurred in the sample "WorkingWIthNativeListView"(https://github.com/xamarin/xamarin-forms-samples/tree/master/WorkingWithListviewNative) via Code before upgrading to, but now it is occurring within XAML as well.

05-05 13:18:23.765 I/MonoDroid(31116): UNHANDLED EXCEPTION:
05-05 13:18:23.768 I/MonoDroid(31116): System.NullReferenceException: Object reference not set to an instance of an object
05-05 13:18:23.768 I/MonoDroid(31116): at Xamarin.Forms.Platform.Android.ListViewAdapter.GetView (int,Android.Views.View,Android.Views.ViewGroup) <IL 0x002b8, 0x017d4>
05-05 13:18:23.768 I/MonoDroid(31116): 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/d23da369/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Widget.BaseAdapter.cs:509
05-05 13:18:23.787 I/MonoDroid(31116): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue*) [0x00084] in /Users/builder/data/lanes/monodroid-maverick05-05 13:18:23.768 I/MonoDroid(31116): at (wrapper dynamic-method) object.2192210b-80ca-4034-b34a-45f305f9be74 (intptr,intptr,int,intptr,intptr) <IL 0x00023, 0x00073>
05-05 13:18:23.777 W/art     (31116): JNI RegisterNativeMethods: attempt to register 0 native methods for md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable

Debug Output:



1) Download attached solution

2) Run on Android device(API 15+)

3) Select the "C" tab, and you should run into the Unhandled Exceptions noted in the Debug Output

*Xamarin.Forms Version

*Version Information

Microsoft Visual Studio Ultimate 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.6.00057

Installed Version: Ultimate

Architecture and Modeling Tools   06181-004-0451031-02320
Microsoft Architecture and Modeling Tools
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

LightSwitch for Visual Studio 2013   06181-004-0451031-02320
Microsoft LightSwitch for Visual Studio 2013

Team Explorer for Visual Studio 2013   06181-004-0451031-02320
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06181-004-0451031-02320
Microsoft Visual Basic 2013

Visual C# 2013   06181-004-0451031-02320
Microsoft Visual C# 2013

Visual C++ 2013   06181-004-0451031-02320
Microsoft Visual C++ 2013

Visual F# 2013   06181-004-0451031-02320
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06181-004-0451031-02320
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Windows Phone SDK 8.0 - ENU   06181-004-0451031-02320
Windows Phone SDK 8.0 - ENU

ApiPortVS   1.0
API portability analyzer.

ASP.NET and Web Tools   12.4.51016.0
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Microsoft Azure Websites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Microsoft Azure

ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.21010.0
For additional information, visit http://www.asp.net/

Color Theme Designer   1.0
Designer for creating new color themes

Common Azure Tools   1.3
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Entity Framework Power Tools   1.0
Adds useful design-time DbContext features to the Visual Studio Solution Explorer context menu. 

When right-clicking on a file containing a derived DbContext class, the following context menu functions are supported:

1) View Entity Data Model - Displays the underlying Code First model in the Entity Framework designer.
2) View Entity Data Model XML - Displays the EDMX XML representing the underlying Code First model.
3) Generate Views - Generates pre-compiled views used by the EF runtime to improve start-up performance. Adds the generated views file to the containing project.

File Nesting   1.0
Automatically nest files based on file name and enables developers to nest and unnest any file manually

JetBrains ReSharper 8.2   Full Edition build on 2014-03-21T01:53:08
JetBrains ReSharper 8.2 package for Microsoft Visual Studio. For more information about ReSharper, visit http://www.jetbrains.com/resharper/. Copyright © 2003–2015 JetBrains, Inc.

Microsoft Advertising SDK for Windows Phone   
Microsoft Advertising SDK for Windows Phone

Microsoft Azure Mobile Services Tools   1.3
Microsoft Azure Mobile Services Tools

Microsoft XNA Game Studio   4.0
Microsoft XNA Game Studio 4.0
Build 4.0.30901.0

NuGet Package Manager   2.8.50926.663
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PowerShell Tools   1.3
Provides file classification services using PowerShell

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

Release Management for Visual Studio Package   1.0
Release Management for Visual Studio

SAPReferenceManager   1.0
Manages References to Shared Projects

SQL Server Data Tools   12.0.41012.0
Microsoft SQL Server Data Tools

Windows Azure Tools   2.3
Windows Azure Tools for Microsoft Visual Studio 2013 - v2.3.20320.1602

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Xamarin   3.11.445.0 (5061f92)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (d23da369e436488f38c8ab8fe8a9ae7d9ea5256b)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.Forms Intellisense   1.0
Provides intellisense for Xamarin.Forms in the XML editor.

Xamarin.iOS (7741cc495ab0baf04ff0405d0604bc27f0ecae2e)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified

Xamarin.TestCloud.Integration   1.0
Early preview of Xamarin Test Cloud integration

XNA Game Studio 4.0   1.0
Information about my package
Comment 3 Parmendra Kumar 2015-05-13 07:25:51 UTC
I have already reported the same bug 27951 and it was working fine with Xamarin.Forms 1.4.3-pre2.

Now I have again check this issue and observed that this issue is working fine when I download this sample from https://github.com/xamarin/xamarin-forms-samples/tree/1.4.3 
commit 622c063d129d1b0990a098dad7f46a375423de34  I am able to reproduce this issue if I download the sample from the master lane as provided in comment #1.

So this issue seems to be resolved with Xamarin.forms 1.4.3-pre2 in branch  https://github.com/xamarin/xamarin-forms-samples/tree/1.4.3
Comment 4 Andres Castro 2015-05-13 07:35:20 UTC
This bug is referring to using Xaml and a ViewCellRenderer. I was able to reproduce the error by converting the viewcell to xaml. https://github.com/acastr7/xamarin-forms-samples/tree/master/WorkingWithListviewNative
Comment 5 Rui Marinho 2015-06-11 11:01:11 UTC
Hi Andres Castro can you remove the reference to the assembly when declaring the local namespace. will be something like this:


And see if it works ok. 

Comment 6 Rui Marinho 2015-06-15 18:27:49 UTC
this should be fixed in 1.4.3 final
Comment 7 Josue Yeray 2015-07-06 11:06:09 UTC
This is not resolved. Same problem as described here in, downgrading not help. This is a critical issue that need to be addressed asap as it is impacting directly on apps that where working before.
Comment 8 Rui Marinho 2015-07-06 13:23:00 UTC
@Josue can you please provide a sample case?

Comment 10 Rui Marinho 2015-08-17 14:30:59 UTC
This particular issue was fixed in 1.4.4 final stable. If you still see this issue please reopen.