Bug 41013 - Crash when scrolling a ListView with recycle caching strategy on iOS
Summary: Crash when scrolling a ListView with recycle caching strategy on iOS
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.2.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-05-11 07:36 UTC by Marc
Modified: 2016-07-01 14:16 UTC (History)
2 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 NOT_REPRODUCIBLE

Description Marc 2016-05-11 07:36:48 UTC
### Overview
ListView with recycle caching strategy crashes when scrolling on iOS


### Steps to Reproduce

1. Load the attached Project based on Matt Whetton infinte scroll listing solution (https://github.com/mattwhetton/Codenutz.XF.InfiniteListView)

2. Compile and Debug the iOS project

3. Scroll the listing until it crashes


### Actual Results

The ListView experience rendering problems, some items are lost and list becomes unsorted. After some scrolling the app crashes with the following unhandled exception:

Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSRangeException Reason: *** -[__NSArrayM objectAtIndex:]: index 9 beyond bounds [0 .. 8]

Native stack trace:

	0   CoreFoundation                      0x008d4494 __exceptionPreprocess + 180

	1   libobjc.A.dylib                     0x08f4fe02 objc_exception_throw + 50

	2   CoreFoundation                      0x00799aa3 -[__NSArrayM objectAtIndex:] + 243

	3   UIKit                               0x038b9b4a -[UITableView _visibleCellForGlobalRow:] + 60

	4   UIKit                               0x03c184cc -[_UITableViewUpdateSupport(Private) _setupAnimationsForExistingVisibleCells] + 635

	5   UIKit                               0x03c259fa -[_UITableViewUpdateSupport _setupAnimations] + 125

	6   UIKit                               0x0389116a -[UITableView _updateWithItems:updateSupport:] + 3728

	7   UIKit                               0x0388910f -[UITableView _endCellAnimationsWithContext:] + 17421

	8   UIKit                               0x038a1830 -[UITableView endUpdatesWithContext:] + 51

	9   UIKit                               0x038a185e -[UITableView endUpdates] + 41

	10  ???                                 0x1acabde4 0x0 + 449494500

	11  ???                                 0x1acfbb68 0x0 + 449821544

	12  ???                                 0x1acfa306 0x0 + 449815302

	13  ???                                 0x1acf9ffc 0x0 + 449814524

	14  ???                                 0x1aca4e22 0x0 + 449465890

	15  ???                                 0x1aca30e0 0x0 + 449458400

	16  ???                                 0x1aaafd8c 0x0 + 447413644

	17  ???                                 0x1acf9f8a 0x0 + 449814410

	18  ???                                 0x1acf9f0c 0x0 + 449814284

	19  ???                                 0x1acf9481 0x0 + 449811585

	20  ???                                 0x1acf8fe4 0x0 + 449810404

	21  ???                                 0x1aaa4c54 0x0 + 447368276

	22  ???                                 0x1aaa4614 0x0 + 447366676

	23  ???                                 0x1aaa4184 0x0 + 447365508

	24  ???                                 0x1aaa402c 0x0 + 447365164

	25  ???                                 0x1aaaaab0 0x0 + 447392432

	26  ???                                 0x1acf8e61 0x0 + 449810017

	27  ???                                 0x1acf8e18 0x0 + 449809944

	28  ???                                 0x1acf4762 0x0 + 449791842

	29  ???                                 0x1acf44ad 0x0 + 449791149

	30  ???                                 0x1acf433c 0x0 + 449790780

	31  ???                                 0x1ace4c5c 0x0 + 449727580

	32  ???                                 0x1ace4fed 0x0 + 449728493

	33  FormsTemplateiOS                    0x001672d1 mono_jit_runtime_invoke + 705

	34  FormsTemplateiOS                    0x0022300f mono_runtime_invoke + 127

	35  FormsTemplateiOS                    0x002f7b97 xamarin_trampoline + 5559

	36  UIKit                               0x038bb934 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 822

	37  UIKit                               0x038bba7d -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 90

	38  UIKit                               0x0388bb32 -[UITableView _updateVisibleCellsNow:isRecursive:] + 3347

	39  UIKit                               0x038aa416 __29-[UITableView layoutSubviews]_block_invoke + 52

	40  UIKit                               0x038c56cc -[UITableView _performWithCachedTraitCollection:] + 88

	41  UIKit                               0x038aa2eb -[UITableView layoutSubviews] + 214

	42  UIKit                               0x038003d4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 810

	43  libobjc.A.dylib                     0x08f64059 -[NSObject performSelector:withObject:] + 70

	44  QuartzCore                          0x0b584096 -[CALayer layoutSublayers] + 144

	45  QuartzCore                          0x0b5778b6 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 388

	46  QuartzCore                          0x0b57771a _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26

	47  QuartzCore                          0x0b569ee7 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 317

	48  QuartzCore                          0x0b59e847 _ZN2CA11Transaction6commitEv + 561

	49  QuartzCore                          0x0b5a00b8 _ZN2CA11Transaction17flush_transactionEv + 50

	50  QuartzCore                          0x0b5af867 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 593

	51  QuartzCore                          0x0b5afccd _ZN2CA7Display16TimerDisplayLink8callbackEP16__CFRunLoopTimerPv + 123

	52  CoreFoundation                      0x0081e136 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22

	53  CoreFoundation                      0x0081db32 __CFRunLoopDoTimer + 1250

	54  CoreFoundation                      0x007dc39a __CFRunLoopRun + 2202

	55  CoreFoundation                      0x007db846 CFRunLoopRunSpecific + 470

	56  CoreFoundation                      0x007db65b CFRunLoopRunInMode + 123

	57  GraphicsServices                    0x0b739664 GSEventRunModal + 192

	58  GraphicsServices                    0x0b7394a1 GSEventRun + 104

	59  UIKit                               0x0372feb9 UIApplicationMain + 160

	60  ???                                 0x1966d7b0 0x0 + 426170288

	61  ???                                 0x1966d5a8 0x0 + 426169768

	62  ???                                 0x16b70680 0x0 + 381093504

	63  ???                                 0x16b703b4 0x0 + 381092788

	64  ???                                 0x16b70548 0x0 + 381093192

	65  FormsTemplateiOS                    0x001672d1 mono_jit_runtime_invoke + 705

	66  FormsTemplateiOS                    0x0022300f mono_runtime_invoke + 127

	67  FormsTemplateiOS                    0x00227ed1 mono_runtime_exec_main + 401

	68  FormsTemplateiOS                    0x00227c95 mono_runtime_run_main + 629

	69  FormsTemplateiOS                    0x000eab5d mono_jit_exec + 93

	70  FormsTemplateiOS                    0x003070a0 xamarin_main + 2384

	71  FormsTemplateiOS                    0x00307981 main + 65

	72  libdyld.dylib                       0x09429a25 start + 1 


### Version Info
Tested with Xamarin.Forms 2.2.0.31


### Environment Info

Microsoft Visual Studio Professional 2015
Versión 14.0.25123.00 Update 2
Microsoft .NET Framework
Versión 4.6.01038

Versión instalada: Professional

Visual Basic 2015   00325-60000-81291-AA625
Microsoft Visual Basic 2015

Visual C# 2015   00325-60000-81291-AA625
Microsoft Visual C# 2015

Visual C++ 2015   00325-60000-81291-AA625
Microsoft Visual C++ 2015

Visual F# 2015   00325-60000-81291-AA625
Microsoft Visual F# 2015

Windows Phone SDK 8.0 - ESN   00325-60000-81291-AA625
Windows Phone SDK 8.0 - ESN

Administrador de paquetes NuGet   3.4.3
Administrador de paquetes NuGet de Visual Studio. Para obtener más información acerca de NuGet, visite http://docs.nuget.org/.

ASP.NET and Web Tools 2015 (RC1 Update 1)   14.1.20203.0
ASP.NET and Web Tools 2015 (RC1 Update 1)

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

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

Azure App Service Tools v2.7.1   14.0.11112.0
Azure App Service Tools v2.7.1

GitHub.VisualStudio   1.0
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

Herramientas comunes de Windows Azure   1.7
Ofrece servicios comunes para su uso con los servicios móviles de Microsoft Azure y Microsoft Azure Tools.

Herramientas de servicios móviles de Microsoft Azure   1.4
Herramientas de servicios móviles de Microsoft Azure

NCrunch   
Continuous Testing Tool for .NET
Copyright © 2010-2016 Remco Software Ltd

Paquete Application Insights Tools para Visual Studio   5.202.60415.1
Application Insights Tools para Visual Studio

PreEmptive Analytics Visualizer   1.2
Extensión de Microsoft Visual Studio para visualizar los resúmenes agregados desde el producto PreEmptive Analytics.

Servicio de lenguaje JavaScript   2.0
Servicio de lenguaje JavaScript

Sistema del proyecto JavaScript   2.0
Sistema del proyecto JavaScript

SQL Server Data Tools   14.0.60311.1
Microsoft SQL Server Data Tools

TypeScript   1.8.30.0
Herramientas de TypeScript para Visual Studio

Visual Studio Tools para Apache Cordova   Update 8.1
Visual Studio Tools para Apache Cordova

Visual Studio Tools para las Aplicaciones Windows universales   14.0.25208.00
Las herramientas Visual Studio Tools para las Aplicaciones Windows universales permiten crear una experiencia de aplicación universal sencilla para todos los dispositivos que ejecutan Windows 10: teléfono, tableta, PC y más. Incluye el kit de desarrollo de software de Microsoft Windows 10.

Xamarin   4.0.3.214 (0dd817c)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

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

Xamarin.iOS   9.6.1.8 (3a25bf1)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 1 Rui Marinho 2016-07-01 14:16:23 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages to 2.3.1-pre1, 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