Bug 24445 - [iOS] Assertion failure in UITableView when viewmodel bound to ListView changes
Summary: [iOS] Assertion failure in UITableView when viewmodel bound to ListView changes
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.0
Hardware: Other Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-11-11 14:14 UTC by David Johnson
Modified: 2018-04-05 18:02 UTC (History)
8 users (show)

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


Attachments
Xamarin Forms project that reproduces the problem (2.53 MB, application/zip)
2014-11-11 14:14 UTC, David Johnson
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:
VERIFIED FIXED

Description David Johnson 2014-11-11 14:14:34 UTC
Created attachment 8692 [details]
Xamarin Forms project that reproduces the problem

I have an application where updates to the data shown in the UI may periodically come from the server. I've been stuck trying to troubleshoot a crash on iOS when the refreshed data is merged into the viewmodel, and finally have been able to reproduce it in the sample below.

The attached zip contains a project with a single page that displays a ListView bound to a viewmodel's Items collection. A background task periodically broadcasts an update to the items via Xamarin Forms MessagingCenter, which is similar to how my application handles the updates coming in from the server socket connection. The viewmodel subscribes to these messages and updates its list to reflect the changes.

This works fine on Android. On iOS, I get this error on the first update broadcast, which crashes the app:

2014-11-11 12:01:27.178 formsiOS[1900:700012] *** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit/UIKit-3318.16.14/UITableView.m:1582

This seems like a bug to me, but if there is something I'm missing in how to safely merge changes into a databound viewmodel so they don't crash the app on iOS, please let me know. Until I get a fix or a workaround for this problem, I am blocked from releasing my application.
Comment 1 David Johnson 2014-11-11 15:15:17 UTC
I have found a workaround for this problem, by replacing the entire ObservableCollection instead of clearing it and re-filling it, which is more efficient anyways.
Comment 2 Parmendra Kumar 2014-12-29 10:16:41 UTC
I have checked this issue with attached sample project. I am also getting same error defined in the bug description.

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

Application Output: https://gist.github.com/Parmendrak/83702eca54bee75911a4
Ide Log: https://gist.github.com/Parmendrak/8a6ad2de5779878d103e
Build Log: https://gist.github.com/Parmendrak/1221a904b2e5679af6b0

Environment info:

=== Xamarin Studio ===

Version 5.7 (build 657)
Installation UUID: 1a096c6f-0678-402e-89b2-a2c10f7e80e4
Runtime:
	Mono 3.10.0 ((detached/92c4884)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000031

=== Apple Developer Tools ===

Xcode 6.1 (6602)
Build 6A1052c

=== Xamarin.iOS ===

Version: 8.6.0.36 (Enterprise Edition)
Hash: fb82d4e
Branch: 
Build date: 2014-12-16 22:30:17-0500

=== Xamarin.Android ===

Version: 5.0.0.8 (Enterprise Edition)
Android SDK: /Users/360_macmini/Desktop/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.10.0.18 (Enterprise Edition)

=== Build Information ===

Release ID: 507000657
Git revision: 012ec6963a2949d3773b96cee5bc4a05dbada096
Build date: 2014-12-16 15:34:30-05
Xamarin addins: 39ab76ee8d2bc1539d561fd800123124d5ee8bdb

=== 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 3 Jason Smith [MSFT] 2015-01-19 16:43:32 UTC
Should be fixed in 1.3.2-pre1
Comment 4 Ram Chandra 2015-01-23 02:18:23 UTC
I have checked this issue with following builds:

Xamarin.Forms 1.3.2.6299-pre1
Mac OS X 10.10.0
Xamarin Studio: 5.7.1 (build 14)
Installation UUID: 6ea47b0d-1852-4aaf-808d-373ff0a5002b
Runtime:
Mono 3.12.0 ((detached/a813491)
GTK+ 2.24.23 (Raleigh theme)
Package version: 312000068
Xcode 6.1 (6604)
Build 6A1052d
Xamarin.iOS: 8.6.0.51 (Business Edition)
Hash: dfb682f
=== Build Information ===
Release ID: 507010014
Git revision: a4dd61ad7f8b3695be4b17bcb5c3ae6b81438cf7
Build date: 2015-01-19 15:21:09-05
Xamarin addins: 081208fe3bbf40e24a562867c6c7fba20a9b94b6

When deploy the attached project I observed that I am not getting any error or exception and application is working fine and it shows the following message on Application output:

> 2015-01-23 12:47:15.186 formsiOS[2349:66602] Returning initial items
> Returning initial items
> 2015-01-23 12:47:25.152 formsiOS[2349:66681] Sending ModelsChanged message
> Sending ModelsChanged message
> 2015-01-23 12:47:35.677 formsiOS[2349:66681] Sending ModelsChanged message
> Sending ModelsChanged message

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

This issue has been fixed. Hence, I am closing this issue.