Bug 23863 - [iOS8] Inserting rows with an animation into a UITableView hangs on the iOS 8 simulator
Summary: [iOS8] Inserting rows with an animation into a UITableView hangs on the iOS 8...
Status: CONFIRMED
Alias: None
Product: iOS
Classification: Xamarin
Component: General (show other bugs)
Version: XI 8.2.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-10-15 17:50 UTC by John Miller [MSFT]
Modified: 2014-12-03 18:21 UTC (History)
4 users (show)

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


Attachments
Test Case (7.18 KB, application/zip)
2014-10-15 17:50 UTC, John Miller [MSFT]
Details

Description John Miller [MSFT] 2014-10-15 17:50:56 UTC
Created attachment 8426 [details]
Test Case

**Overview:**

   Inserting rows into a table causes a hang only on the iOS 8 simulator. 

**Steps to Reproduce:**

   1. Run the attached sample on an iOS 8 simulator.
   2. Toggle the switch

**Actual Results:**

   App hangs. 

**Expected Results:**

   No hang. Run on the iOS 7.1 simulator to see no hang. 

**Build Date & Platform:**

   XI 8.2

**Additional Information:**

   Changing the table animation to .None produces this exception message:

Objective-C exception thrown.  Name: NSInternalInconsistencyException Reason: Invalid update: invalid number of rows in section 0.  The number of rows contained in an existing section after the update (1) must be equal to the number of rows contained in that section before the update (1), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).

   Possibly related: https://github.com/migueldeicaza/MonoTouch.Dialog/issues/227
Comment 1 Sadik Ali 2014-10-16 03:20:19 UTC
I have checked this issue and able to reproduce this issue. To reproduce this issue I have followed the steps and sample application provided in bug description.

I observed that that when the attached sample run on an iOS 8 simulator and toggle the switch the app gets hang, and I also observed that when the attached sample run on an iOS 7.1 simulator and toggle the switch the app does't get hang and working as expected.

Screencast(App Hang): http://www.screencast.com/t/sXyKbjQ2UE

Screencast(App No Hang): http://www.screencast.com/t/Vy9eXyVx9

Environment Info:

=== Xamarin Studio ===

Version 5.5 (build 227)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Runtime:
	Mono 3.10.0 ((detached/47db868)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000019

=== Apple Developer Tools ===

Xcode 6.0.1 (6528)
Build 6A317

=== Xamarin.Mac ===

Version: 1.10.0.13 (Business Edition)

=== Xamarin.Android ===

Version: 4.18.0 (Business Edition)
Android SDK: /Users/MM/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.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.iOS ===

Version: 8.2.0.193 (Business Edition)
Hash: 959c1e4
Branch: 
Build date: 2014-10-03 00:25:37-0400

=== Build Information ===

Release ID: 505000227
Git revision: 7b721eeec7a2fa4c4f4de0ecd2aed4dc25edac95
Build date: 2014-10-02 15:53:38-04
Xamarin addins: 99ed56b428b31eba1efaace4d82188d6f334e6ca

=== Operating System ===

Mac OS X 10.9.5
Darwin MacMini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 2 Guillaume 2014-10-16 15:42:12 UTC
This is also true on a device running iOS 8, not only on the simulator.
Comment 3 Sebastien Pouliot 2014-10-21 09:46:00 UTC
That looks like an iOS8 bug wrt layout changes (new engine). Native backtrace is:

frame #0: 0x0735d0be libobjc.A.dylib`objc_msgSend + 26
frame #1: 0x03418bf2 UIKit`-[UITableViewCellLayoutManager editingAccessoryShouldAppearForCell:] + 43
frame #2: 0x034186ea UIKit`-[UITableViewCellLayoutManager reorderControlShouldFadeForCell:] + 176
frame #3: 0x0341636b UIKit`-[UITableViewCellLayoutManager layoutSubviewsOfCell:] + 2453
frame #4: 0x0330ad16 UIKit`-[UITableViewCell layoutSubviews] + 89
frame #5: 0x030a09c0 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 608
frame #6: 0x0735f771 libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
frame #7: 0x0963627f QuartzCore`-[CALayer layoutSublayers] + 152
frame #8: 0x0962a105 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 397
frame #9: 0x09629f60 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 26
frame #10: 0x09588676 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 284
frame #11: 0x09589a3c QuartzCore`CA::Transaction::commit() + 392
frame #12: 0x0964f789 QuartzCore`+[CATransaction flush] + 52
frame #13: 0x030120d3 UIKit`_UIApplicationHandleEventQueue + 2296
frame #14: 0x0061e7bf CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
frame #15: 0x006142cd CoreFoundation`__CFRunLoopDoSources0 + 253
frame #16: 0x00613828 CoreFoundation`__CFRunLoopRun + 952
frame #17: 0x006131ab CoreFoundation`CFRunLoopRunSpecific + 443
frame #18: 0x00612fdb CoreFoundation`CFRunLoopRunInMode + 123
frame #19: 0x0981524f GraphicsServices`GSEventRunModal + 192
frame #20: 0x0981508c GraphicsServices`GSEventRun + 104
frame #21: 0x03015e16 UIKit`UIApplicationMain + 1526
frame #22: 0x15f95b68 (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr) + 0x1e8 (0x15f95980 0x15f95c7d) [0x14142e00 - MonoTouch]
frame #23: 0x15f95968 MonoTouch.UIKit.UIApplication:Main (string[],intptr,intptr) + 0x50 (0x15f95918 0x15f95971) [0x14142e00 - MonoTouch]
frame #24: 0x15f93ce0 MonoTouch.UIKit.UIApplication:Main (string[],string,string) + 0xf8 (0x15f93be8 0x15f93cf2) [0x14142e00 - MonoTouch]
frame #25: 0x15f93a8c MTDFreeze.Application:Main (string[]) + 0x44 (0x15f93a48 0x15f93a9c) [0x14142e00 - MonoTouch]
frame #26: 0x15f93bc2 (wrapper runtime-invoke) <Module>:runtime_invoke_void_object (object,intptr,intptr,intptr) + 0x11a (0x15f93aa8 0x15f93be2) [0x14142e00 - MonoTouch]
frame #27: 0x00104805 MTDFreeze`mono_jit_runtime_invoke(method=<unavailable>, obj=<unavailable>, params=<unavailable>, exc=<unavailable>) + 725 at mini.c:6724
frame #28: 0x001a27ff MTDFreeze`mono_runtime_invoke(method=0x7c5cc474, obj=0x00000000, params=<unavailable>, exc=<unavailable>) + 127 at object.c:2842
frame #29: 0x001a7601 MTDFreeze`mono_runtime_exec_main(method=0x7c5cc474, args=<unavailable>, exc=0x00000000) + 401 at object.c:4099
frame #30: 0x001a73c4 MTDFreeze`mono_runtime_run_main(method=0x15738350, argc=<unavailable>, argv=<unavailable>, exc=<unavailable>) + 628 at object.c:3725
frame #31: 0x000638bd MTDFreeze`mono_jit_exec(domain=0x14142e00, assembly=0x7d720f60, argc=<unavailable>, argv=<unavailable>) + 93 at driver.g.c:1009
frame #32: 0x00244bd4 MTDFreeze`xamarin_main(argc=3, argv=0xbfff3a68, is_extension=false) + 2500 at monotouch-main.m:400
frame #33: 0x0025ac45 MTDFreeze`main(argc=3, argv=0xbfff3a68) + 117 at simlauncher.m:37
frame #34: 0x07687ac9 libdyld.dylib`start + 1
Comment 4 Sebastien Pouliot 2014-10-21 10:04:00 UTC
>    Changing the table animation to .None produces this exception message:

That's totally normal because:

> You should not call reloadData within the group; 
> if you call this method within the group, 
> you will need to perform any animations yourself.

ref: https://developer.apple.com/Library/ios/documentation/UIKit/Reference/UITableView_Class/index.html

MTD will call Reload in such case - if you do not do any animation then there's no point in calling the Remove/Insert inside [Begin|End]Updates
Comment 5 Guillaume 2014-12-03 18:21:51 UTC
Can you please have a look at https://github.com/migueldeicaza/MonoTouch.Dialog/pull/229?

Thansk,
G.

Note You need to log in before you can comment on or make changes to this bug.