Bug 21525 - System.ArgumentOutOfRangeException for xaml TableView (Android only)
Summary: System.ArgumentOutOfRangeException for xaml TableView (Android only)
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.2
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2014-07-22 16:53 UTC by Jon Goldberger [MSFT]
Modified: 2016-03-15 19:31 UTC (History)
5 users (show)

Tags: AC
Is this bug a regression?: ---
Last known good build:

Test Project (2.91 MB, application/zip)
2014-07-22 16:53 UTC, Jon Goldberger [MSFT]

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 Goldberger [MSFT] 2014-07-22 16:53:56 UTC
Created attachment 7460 [details]
Test Project

To reproduce (issue on Android only, works on iOS):

1. Open attached test project.
2. Set Android app as startup project.
3. Launch app on device/emulator

Expected result: A TableView will be displayed.
Actual result: App crashes with stack trace below.

However removing one ViewCell avoids app crash and UI is loaded. To test:
1. Open TableView1.xaml file.
2. comment out either of the two ViewCells in the Network table section at lines 50-58 or lines 59-73.
3. Launch app.

Expected result: TableView will be displayed.
Actual result: as expected. 

Stack trace:
>[MonoDroid] UNHANDLED EXCEPTION: System.ArgumentOutOfRangeException: Argument is out of range.
>[MonoDroid] Parameter name: index
>[MonoDroid] at System.Collections.Generic.List`1<Xamarin.Forms.Element>.get_Item (int) <0x0007c>
>[MonoDroid] at System.Collections.ObjectModel.Collection`1<Xamarin.Forms.Element>.get_Item (int) <0x00083>
>[MonoDroid] at System.Collections.ObjectModel.ReadOnlyCollection`1<Xamarin.Forms.Element>.get_Item (int) <0x00083>
>[MonoDroid] at Xamarin.Forms.Platform.Android.VisualElementPackager.SetModel (Xamarin.Forms.VisualElement,Xamarin.Forms.VisualElement) <IL 0x0010b, 0x00947>
>[MonoDroid] at Xamarin.Forms.Platform.Android.VisualElementPackager.<.ctor>b__0 (object,Xamarin.Forms.Platform.Android.VisualElementChangedEventArgs) <IL 0x0000d, 0x000a3>
>[MonoDroid] at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs`1<Xamarin.Forms.View>) <0x00137>
>[MonoDroid] at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.SetElement (Xamarin.Forms.View) <0x004df>
>[MonoDroid] at Xamarin.Forms.Platform.Android.VisualElementRenderer`1<Xamarin.Forms.View>.Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement) <0x0012b>
>[MonoDroid] at Xamarin.Forms.Platform.Android.ViewCellRenderer/ViewCellContainer.Update (Xamarin.Forms.ViewCell) <IL 0x00050, 0x0034b>
>[MonoDroid] at Xamarin.Forms.Platform.Android.ViewCellRenderer.GetCellCore (Xamarin.Forms.Cell,Android.Views.View,Android.Views.ViewGroup,Android.Content.Context) <IL 0x00013, 0x00143>
>[MonoDroid] at Xamarin.Forms.Platform.Android.CellRenderer.GetCell (Xamarin.Forms.Cell,Android.Views.View,Android.Views.ViewGroup,Android.Content.Context) <IL 0x0005c, 0x002eb>
>[MonoDroid] 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>
>[MonoDroid] at Xamarin.Forms.Platform.Android.TableViewModelRenderer.GetView (int,Android.Views.View,Android.Views.ViewGroup) <IL 0x00033, 0x001c7>
>[MonoDroid] 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.12-series/163212a9/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.Widget.BaseAdapter.cs:460
>[MonoDroid] at (wrapper dynamic-method) object.e13cb1fa-be77-4f01-b6d9-ebfa85f0ed22 (intptr,intptr,int,intptr,intptr) <IL 0x00023, 0x0005f>
Comment 2 Jon Goldberger [MSFT] 2014-07-22 18:45:24 UTC
Note the same issue occurs if I build the same TableView in code. 

Gist: https://gist.github.com/jgold6/9b95b6ae67a32ffa2705
Comment 3 Jon Goldberger [MSFT] 2014-07-22 18:47:26 UTC
Oops, mistake in the above comment.

Correction:  the same issue occur does NOT occur if I build the same TableView in code.
(See gist in the above comment)
Comment 4 Parmendra Kumar 2014-08-13 11:53:38 UTC
I have checked this issue and able to reproduce this, To reproduce this issue I have followed the steps mentioned in bug description.

Screencast: http://www.screencast.com/t/coV2D5FtW80H

Application Log output: https://gist.github.com/shrutis360/6b427fa2dd92bb403e5c

IDE Log : https://gist.github.com/shrutis360/5cc375921d394efb60cb

Environment info:

=== Xamarin Studio ===

Version 5.2.1 (build 1)
Installation UUID: 1a096c6f-0678-402e-89b2-a2c10f7e80e4
	Mono 3.6.0 ((no/f540f8a)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 306000039

=== Xamarin.Android ===

Version: 4.14.0 (Business Edition)
Android SDK: /Users/360_macmini/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)
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 5.1 (5084)
Build 5B130a

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 606f31a
Build date: 2014-08-01 15:27:48-0400

=== Xamarin.Mac ===

Version: (Business Edition)

=== Build Information ===

Release ID: 502010001
Git revision: d06832ce9807d6be24aca225457e8b37c7669f6f
Build date: 2014-08-07 12:10:47-04
Xamarin addins: 1de032531be4cecf2f39dbee3b87aac78204058c

=== Operating System ===

Mac OS X 10.9.4
Darwin ShrutiMac.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
Comment 5 Jason Smith [MSFT] 2016-03-15 19:31:13 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