Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] NullReferenceException thrown in DataTemplateExtensions.CreateContent #14386

Open
keegan-gehrig opened this issue Jul 1, 2021 · 2 comments
Labels
a/Xaml </> s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/unverified New report that has yet to be verified t/bug 🐛

Comments

@keegan-gehrig
Copy link

Description

There is an application crash being reported periodically in AppCenter for our Xamarin.Forms applications. This is happening both for our Android app and our iOS app. The stack traces listed in AppCenter don't point to anywhere in our code where this is happening (it all seems to be within Xamarin.Forms' ListViewAdapter & ListViewRenderer classes), and we haven't been able to reproduce the issue or see it for ourselves, so unfortunately we can't provide a reproduction case at this time. We also don't know exactly what is being done within our app to cause this crash, so this is more of a general bug report to alert Xamarin that there might be an issue that needs to be looked into in the DataTemplateExtensions.CreateContent method.

Steps to Reproduce

Reproduction Steps Unknown at this time.

Expected Behavior

The app won't crash due to a null reference encountered in the DataTemplateExtensions.CreateContent method

Actual Behavior

A null reference encountered in the DataTemplateExtensions.CreateContent method is currently causing our app to crash

Android Exception Stack Trace from AppCenter

DataTemplateExtensions.CreateContent (Xamarin.Forms.DataTemplate self, System.Object item, Xamarin.Forms.BindableObject container)
TemplatedItemsList`2[TView,TItem].ActivateContent (System.Int32 index, System.Object item)
TemplatedItemsList`2[TView,TItem].CreateContent (System.Int32 index, System.Object item, System.Boolean insert)
TemplatedItemsList`2[TView,TItem].GetOrCreateContent (System.Int32 index, System.Object item)
TemplatedItemsList`2[TView,TItem].get_Item (System.Int32 index)
ListViewAdapter.GetCellsFromPosition (System.Int32 position, System.Int32 take)
ListViewAdapter.GetView (System.Int32 position, Android.Views.View convertView, Android.Views.ViewGroup parent)
BaseAdapter.n_GetView_ILandroid_view_View_Landroid_view_ViewGroup_ (System.IntPtr jnienv, System.IntPtr native__this, System.Int32 position, System.IntPtr native_convertView, System.IntPtr native_parent)
(wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.89(intptr,intptr,int,intptr,intptr)

iOS Exception Stack Trace from AppCenter

DataTemplateExtensions.CreateContent (Xamarin.Forms.DataTemplate self, System.Object item, Xamarin.Forms.BindableObject container)
TemplatedItemsList`2[TView,TItem].ActivateContent (System.Int32 index, System.Object item)
TemplatedItemsList`2[TView,TItem].CreateContent (System.Int32 index, System.Object item, System.Boolean insert)
TemplatedItemsList`2[TView,TItem].GetOrCreateContent (System.Int32 index, System.Object item)
TemplatedItemsList`2[TView,TItem].get_Item (System.Int32 index)
ListViewRenderer+ListViewDataSource.GetCellForPath (Foundation.NSIndexPath indexPath)
ListViewRenderer+ListViewDataSource.GetCell (UIKit.UITableView tableView, Foundation.NSIndexPath indexPath)
ListViewDataSource.GetCell (UIKit.UITableView tableView, Foundation.NSIndexPath indexPath)
(wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate)
UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName)
Application.Main (System.String[] args)

Basic Information

  • Version with issue: Xamarin.Forms 5.0.0.2012
  • Last known good version: Unknown
  • Platform Target Frameworks:
    • iOS: 9.0 (minimum OS Version)
    • Android: 10.0 (API Level 29) - 5.0 (API Level 21 minimum OS version)
    • UWP: 17763 (16299 minimum OS Version)
  • Android Support Library / AndroidX Version: Xamarin.AndroidX.Core version 1.3.2.1
  • NuGet Packages:
  • Affected Devices: Android, iOS

Environment

Show/Hide Visual Studio info - Visual Studio for Mac
=== Visual Studio Community 2019 for Mac ===
Version 8.9.7 (build 8)
Installation UUID: 4da24ecf-cd40-4e2b-85d0-1420414543d5
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)
	Package version: 612000125
=== Mono Framework MDK ===
Runtime:
	Mono 6.12.0.125 (2020-02/8c552e98bd6) (64-bit)
	Package version: 612000125
=== Roslyn (Language Service) ===
3.9.0-6.21152.10+c10f884b30737542ddd84ca889a4aad9281ce210
=== NuGet ===
Version: 5.8.0.6860
=== .NET Core SDK ===
SDK: /usr/local/share/dotnet/sdk/5.0.202/Sdks
SDK Versions:
	5.0.202
	5.0.201
	5.0.103
	3.1.408
	3.1.407
	3.1.301
	3.1.102
	3.1.101
MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks
=== .NET Core Runtime ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	5.0.5
	5.0.4
	5.0.3
	3.1.14
	3.1.13
	3.1.5
	3.1.2
	3.1.1
	2.1.23
	2.1.19
	2.1.16
	2.1.15
=== .NET Core 3.1 SDK ===
SDK: 3.1.408
=== Xamarin.Profiler ===
Version: 1.6.13.11
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Updater ===
Version: 11
=== Apple Developer Tools ===
Xcode 12.5.1 (18212)
Build 12E507
=== Xamarin.Mac ===
Version: 7.8.2.5 (Visual Studio Community)
Hash: 3836759d4
Branch: d16-9
Build date: 2021-02-10 17:56:43-0500
=== Xamarin.iOS ===
Version: 14.14.2.5 (Visual Studio Community)
Hash: 3836759d4
Branch: d16-9
Build date: 2021-02-10 17:56:44-0500
=== Xamarin Designer ===
Version: 16.9.0.324
Hash: b1e216c75
Branch: remotes/origin/d16-9
Build date: 2021-04-16 00:02:50 UTC
=== Xamarin.Android ===
Version: 11.2.2.1 (Visual Studio Community)
Commit: xamarin-android/d16-9/877f572
Android SDK: /Users/developer/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.4 (API level 19)
		5.0 (API level 21)
		5.1 (API level 22)
		6.0 (API level 23)
		7.0 (API level 24)
		7.1 (API level 25)
		8.0 (API level 26)
		8.1 (API level 27)
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.4
SDK Build Tools Version: 28.0.3
Build Information: 
Mono: 5e9cb6d
Java.Interop: xamarin/java.interop/d16-9@54f8c24
ProGuard: Guardsquare/proguard/v7.0.1@912d149
SQLite: xamarin/sqlite/3.34.1@daff8f4
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-9@d210f11
=== Microsoft OpenJDK for Mobile ===
Java SDK: /Users/developer/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Android SDK Manager ===
Version: 16.9.0.22
Hash: a391de2
Branch: remotes/origin/d16-9~2
Build date: 2021-03-24 08:30:26 UTC
=== Android Device Manager ===
Version: 16.9.0.17
Hash: fc2b3db
Branch: remotes/origin/dev/jmt/d16-9bump~1
Build date: 2021-03-24 08:30:44 UTC
=== Build Information ===
Release ID: 809070008
Git revision: 8b7ac2442978ec88d09703fafa4e43eb774f0a26
Build date: 2021-04-16 07:38:03-04
Build branch: release-8.9
Xamarin extensions: 8b7ac2442978ec88d09703fafa4e43eb774f0a26
=== Operating System ===
Mac OS X 10.16.0
Darwin 20.3.0 Darwin Kernel Version 20.3.0
    Thu Jan 21 00:07:06 PST 2021
    root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
@keegan-gehrig keegan-gehrig added s/unverified New report that has yet to be verified t/bug 🐛 labels Jul 1, 2021
@jsuarezruiz
Copy link
Contributor

@keegan-gehrig Could you share the cell used and if is a ViewCell the content hierarchy? what is the root element (Grid, Frame etc)?

@jsuarezruiz jsuarezruiz added the s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. label Sep 6, 2021
@keegan-gehrig
Copy link
Author

keegan-gehrig commented Sep 10, 2021

@jsuarezruiz All of our cells are inheriting from ViewCell as a base. And the root element that we put our cells into is a Grid. Unfortunately, its kind of hard for us to give more specifics, as we haven't been able to reproduce this issue ourselves yet (we're just going off of the crash logs we see), but please let us know if any further information is needed and we can try to answer to the best of our abilities.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/Xaml </> s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/unverified New report that has yet to be verified t/bug 🐛
Projects
None yet
Development

No branches or pull requests

2 participants