Bug 21108 - Adding entries to the beginning of a ListView when using a StackLayout in a ViewCell causes out of order display of entries.
Summary: Adding entries to the beginning of a ListView when using a StackLayout in a V...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.1.0
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jason Smith [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2014-07-03 14:40 UTC by Jon Goldberger [MSFT]
Modified: 2015-02-02 01:51 UTC (History)
5 users (show)

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


Attachments
Test Project (23.05 KB, application/zip)
2014-07-03 14:40 UTC, Jon Goldberger [MSFT]
Details


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 Jon Goldberger [MSFT] 2014-07-03 14:40:46 UTC
Created attachment 7270 [details]
Test Project

Adding entries to the beginning of a ListView when using a StackLayout in a ViewCell causes out of order display of entries.

To reproduce:

1. Open solution and deploy Android project.
2. Click the button until the screen is more than full of list view items, at least 3 or 4 more than the screen can display.
3. Scroll down and up.

Expected results: Items should be displayed in reverse numerical order.

Actual results: Erroneous item numbers are displayed towards the bottom.
Comment 2 Jon Goldberger [MSFT] 2014-07-03 14:55:35 UTC
Note:

This does not occur if using a Label instead of a StackLayout with a nested Label in the ViewCell. 

This also does not occur if you add the new items to the end of entries with:
entries.Add(...)
instead of inserting them to the beginning of the list with 
entries.Insert(0, ..)

The above is in the button.Clicked event handler in App.cs
Comment 3 Eric Maupin 2014-07-14 11:24:14 UTC
Does this still occur on 1.2.1? I can't reproduce this with the given sample.
Comment 4 Jon Goldberger [MSFT] 2014-07-14 12:46:50 UTC
On version 1.2.1.6229, I am getting an exception before the UI displays:

UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
[MonoDroid] at Xamarin.Forms.Platform.Android.Platform.SetActionBarTextColor () <IL 0x00006, 0x0008c>
[MonoDroid] at Xamarin.Forms.Platform.Android.Platform.UpdateActionBarTextColor () <IL 0x00001, 0x00043>
[MonoDroid] at Xamarin.Forms.Platform.Android.Platform.OnLayout (bool,int,int,int,int) <IL 0x00004, 0x000ab>
[MonoDroid] at Xamarin.Forms.Platform.Android.PlatformRenderer.OnLayout (bool,int,int,int,int) <IL 0x0001b, 0x000d3>
[MonoDroid] at Android.Views.ViewGroup.n_OnLayout_ZIIII (intptr,intptr,bool,int,int,int,int) [0x00009] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/163212a9/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.Views.ViewGroup.cs:3274
[MonoDroid] at (wrapper dynamic-method) object.b37092dc-e116-4d77-b85a-9f3cf913dc35 (intptr,intptr,bool,int,int,int,int) <IL 0x0002f, 0x00093>


This is the same stack trace I saw in this bug report: https://bugzilla.xamarin.com/show_bug.cgi?id=21280
Comment 5 Rodja Trappe 2014-07-14 13:32:24 UTC
I tried updating Xamarin.Forms and reproducing the bug. But I'm getting a black screen and the app hangs up with the message "... isn't responding. Do you want to close it?".
But even worse: When searching for minimum example I end up with the default "Blank App (Xamarin.Forms Shared)" solution containing nothing but a "Hello, Forms!" label. After updating the packages for this solution I get the very same black screen!

Thus, I've no clue how to use this new version for any of our projects!
Or maybe there's an undocumented trick how to get this version running. I don't know.
Comment 6 Eric Maupin 2014-07-14 15:59:33 UTC
Duplicate of #20784 which has a working repro.

*** This bug has been marked as a duplicate of bug 20784 ***
Comment 7 Ram Chandra 2014-11-27 08:54:08 UTC
I have checked this issue and I observed that I am still getting this behavior.

I have build and deploy the attached project on device (Samsung S5 4.4.2)  and XAP Nexus S and I observed that now when I add entries to the beginning of a ListView when using a StackLayout in a ViewCell  entries are still displayed unordered.

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

Application Output: https://gist.github.com/saurabh360/67f833e1e9520f03ea44
IDE logs: https://gist.github.com/saurabh360/5909cb42c262cd956b98
ADB logs: https://gist.github.com/saurabh360/8283538ea711726a147b

Please let me know if I can provide more info to this issue.

Environment Info:

=== Xamarin Studio ===

Version 5.7 (build 596)
Installation UUID: 6ea47b0d-1852-4aaf-808d-373ff0a5002b
Runtime:
	Mono 3.12.0 ((detached/b75fa2b)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000046

=== Apple Developer Tools ===

Xcode 6.1 (6604)
Build 6A1052d

=== Xamarin.iOS ===

Version: 8.6.0.5 (Trial Edition)
Hash: 880cc21
Branch: 
Build date: 2014-11-25 12:12:17-0500

=== Xamarin.Android ===

Version: 5.0.0.0 (Trial Edition)
Android SDK: /Users/jatin66/Desktop/Backup/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		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)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin.Mac ===

Version: 1.11.0.1 (Trial Edition)

=== Build Information ===

Release ID: 507000596
Git revision: d996e9ba6874a0d64241e43e5e6b06322ce29c84
Build date: 2014-11-25 17:17:54-05
Xamarin addins: 8ca19707b41536a391f53364ee4ff9272711feb0

=== Operating System ===

Mac OS X 10.10.0
Darwin Jatin66s-iMac.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 8 Jason Smith [MSFT] 2015-02-02 01:51:09 UTC
Can no longer reproduce in 1.3.2