Bug 24255 - [Android] XF throws an System.InvalidOperationException when we use the custom listview item
Summary: [Android] XF throws an System.InvalidOperationException when we use the custo...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.3
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-11-04 13:09 UTC by Prashant Cholachagudda
Modified: 2016-03-25 18:10 UTC (History)
4 users (show)

Tags:
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:
Status:
RESOLVED FIXED

Description Prashant Cholachagudda 2014-11-04 13:09:53 UTC
On Android using custom listview item (platform specific XAML, without custom renderers) fails with  following exception

System.InvalidOperationException: SetElement did not create the correct number of children
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement,Xamarin.Forms.VisualElement) <IL 0x00173, 0x00a60>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.VisualElementPackager.<.ctor>b__0 (object,Xamarin.Forms.Platform.Android.VisualElementChangedEventArgs) <IL 0x0000d, 0x000a3>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs`1<Xamarin.Forms.View>) <0x00137>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.SetElement (Xamarin.Forms.View) <0x0060b>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement) <0x0012b>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement,Xamarin.Forms.Platform.Android.IVisualElementRenderer,Xamarin.Forms.Platform.Android.RendererPool,bool) <IL 0x00029, 0x001bf>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement,Xamarin.Forms.VisualElement) <IL 0x00116, 0x00827>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.VisualElementPackager.<.ctor>b__0 (object,Xamarin.Forms.Platform.Android.VisualElementChangedEventArgs) <IL 0x0000d, 0x000a3>
An unhandled exception occured.

11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs`1<Xamarin.Forms.View>) <0x00137>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.SetElement (Xamarin.Forms.View) <0x0060b>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement) <0x0012b>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement,Xamarin.Forms.Platform.Android.IVisualElementRenderer,Xamarin.Forms.Platform.Android.RendererPool,bool) <IL 0x00029, 0x001bf>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement,Xamarin.Forms.VisualElement) <IL 0x00116, 0x00827>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.VisualElementPackager.<.ctor>b__0 (object,Xamarin.Forms.Platform.Android.VisualElementChangedEventArgs) <IL 0x0000d, 0x000a3>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs`1<Xamarin.Forms.View>) <0x00137>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.SetElement (Xamarin.Forms.View) <0x0060b>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement) <0x0012b>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.ViewCellRenderer/ViewCellContainer.Update (Xamarin.Forms.ViewCell) <IL 0x000a1, 0x00637>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.ViewCellRenderer.GetCellCore (Xamarin.Forms.Cell,Android.Views.View,Android.Views.ViewGroup,Android.Content.Context) <IL 0x00013, 0x00143>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.CellRenderer.GetCell (Xamarin.Forms.Cell,Android.Views.View,Android.Views.ViewGroup,Android.Content.Context) <IL 0x00055, 0x002a3>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.CellFactory.GetCell (Xamarin.Forms.Cell,Android.Views.View,Android.Views.ViewGroup,Android.Content.Context,Xamarin.Forms.View) <IL 0x00028, 0x00193>
11-04 08:50:22.929 I/MonoDroid( 3576): at Xamarin.Forms.Platform.Android.ListViewAdapter.GetView (int,Android.Views.View,Android.Views.ViewGroup) <IL 0x0009f, 0x005cf>
11-04 08:50:22.929 I/MonoDroid( 3576): 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.18-series/5474129a/source/monodroid/src/Mono.Android/platforms/android-16/src/generated/Android.Widget.BaseAdapter.cs:460
Comment 2 Shruti 2014-11-05 02:13:49 UTC
I have checked this issue with attached project given in comment 1 but not able to reproduce it.

 App is getting deployed on device and simulator without raising any error/exception. Also, I did not see  boxview and listView on Android app after launching. Whether, I am able to see boxview and listview in iOS application.

Screencast : http://screencast.com/t/Ic7nxAIfWk8k

Device : Samsung Galaxy Note 3

Environment Info : 
=== Xamarin Studio ===

Version 5.5.3 (build 6)
Installation UUID: 67eaf3b4-f8a7-4ab4-a9df-3197350ca5dc
Runtime:
	Mono 3.10.0 ((detached/fe854ad)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000025

=== Xamarin.Android ===

Version: 4.18.1 (Business Edition)
Android SDK: /Users/ixamarin78/Desktop/android-sdk-macosx
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		3.2    (API level 13)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		4.5    (API level 21)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

=== Apple Developer Tools ===

Xcode 6.1 (6604)
Build 6A1052d

=== Xamarin.iOS ===

Version: 8.4.0.15 (Business Edition)
Hash: 08968c4
Branch: 
Build date: 2014-10-20 21:48:06-0400

=== Xamarin.Mac ===

Version:

=== Build Information ===

Release ID: 505030006
Git revision: fbe3e9453daf6a3bb9a9709ed22bec35f7c9056b
Build date: 2014-10-23 13:08:38-04
Xamarin addins: e44add2b39de4dd57c0742bb2e620dfad84c64c6

=== Operating System ===

Mac OS X 10.9.4
Darwin XamnewiMac.local 13.3.0 Darwin Kernel Version 13.3.0
    Tue Jun  3 21:27:35 PDT 2014
    root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64

Please, let me know If I missed anything to reproduce this issue.
Comment 3 Jason Smith [MSFT] 2016-03-25 18:10:01 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we no longer believe it affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.
 
For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d

Warm regards,
Xamarin Forms Team