Bug 27390 - Runtime crash
Summary: Runtime crash
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: master
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-02-25 01:38 UTC by Kent
Modified: 2017-07-26 07:03 UTC (History)
4 users (show)

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

Crash report (85.54 KB, application/octet-stream)
2015-02-25 01:38 UTC, Kent
The repro (package restore required) (14.74 KB, application/zip)
2015-02-25 02:18 UTC, Kent

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 Kent 2015-02-25 01:38:41 UTC
Created attachment 10018 [details]
Crash report

Whilst attempting to track down a bug in RxUI, I've stumbled upon a runtime crash (presumably because the initial challenge wasn't enough). I've attached the crash report and the repro project. You may need to run the project several times before it crashes. You may get an exception instead (the RxUI problem I am attempting to fix). Please just keep running it until it crashes the runtime.

Oh, and I can't check whether it crashes on a device because it's been 9 days (!) since my enquiry to sales and I'm *still* without a valid license (trial only). *grrrr* It's been over 24 hours since I created the project, and I'm not about to recreate it just so I can run on device.
Comment 1 Kent 2015-02-25 02:18:11 UTC
Created attachment 10019 [details]
The repro (package restore required)
Comment 2 Rolf Bjarne Kvinge [MSFT] 2015-02-25 06:00:31 UTC
It looks like you're using Visual Studio; can you reproduce the crash using Xamarin Studio also? If so, please add the version information from Xamarin Studio's About dialog.
Comment 3 Kent 2015-02-25 19:40:04 UTC
Yes, I can reproduce in XS (although it took 5 runs to get it to trigger). To be honest, it looks a lot like the actual issue I'm trying to resolve is sometimes resulting in a trapped exception and sometimes resulting in a runtime crash.

Aside: why is it that in VS I need extra references (System.Runtime, System.Threading, System.Threading.Tasks) whereas in XS I do not? This has been bugging me since making the switch to VS about a month ago.

Here is my installation details:

=== Xamarin Studio ===

Version 5.7.2 (build 2)
Installation UUID: f9522136-a8cf-42ce-9c1a-403970fc60e9
	Mono 3.12.0 ((detached/b8f5055)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000077

=== Apple Developer Tools ===

Xcode 6.1.1 (6611)
Build 6A2008a

=== Xamarin.Android ===

Version: (Trial Edition)
Android SDK: /Users/kent/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0   (API level 14)
		4.0.3 (API level 15)
Java SDK: /usr
No Java runtime present, requesting install.

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 862702c
Build date: 2015-02-18 15:19:23-0500

=== Xamarin.Mac ===

Not Installed

=== Build Information ===

Release ID: 507020002
Git revision: d6231e6325f274cea59da478410f561312c5b401
Build date: 2015-02-17 19:04:38-05
Xamarin addins: b212fd66838b0d6e2435966e541e66ab9c988698

=== Operating System ===

Mac OS X 10.10.2
Darwin Krang 14.1.0 Darwin Kernel Version 14.1.0
    Mon Dec 22 23:10:38 PST 2014
    root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64
Comment 4 Rolf Bjarne Kvinge [MSFT] 2015-03-04 08:24:52 UTC
I've been able to reproduce this crash as well.

What I've been able to figure out:

1. Sometimes the app calls UITableView.Begin|EndUpdates (stack trace: https://gist.github.com/rolfbjarne/3f6c8e2f717549816081), sometimes it does not. When it doesn't, everything works fine.

2. When the app calls Begin|EndUpdates, there's either a crash or an NSInternalInconsistencyException.

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

   The exact numbers vary between each runs.

4. At the point of the crash/exception there is a list of "Active" + "Inactive" cells in the UITableView, and the exact number of cells vary between each run. Fewer cells (5-6) seems to be related to exceptions, and more (10+) seems to be related to crashes.

However I have not been able to determine the exact cause of the crash, but it seems to be some buffer overflows in Apple code (object pointers suddenly start pointing to garbage). The random nature of the test case hasn't helped; the deeper I dig using a native debugger, the more often I get the exception instead of the crash.

Do you think this is enough information for you to narrow down further what's going on? My usual procedure is to create a smaller and smaller test case by cutting down code, but even though the test project is small, it depends on several PCL libraries which are binary only, and I can't narrow it down there as easily.

BTW the crash occurs on device as well.
Comment 5 John Miller [MSFT] 2017-07-25 12:41:50 UTC
Because we have not received a reply to our request for more information, we are marking this issue as RESOLVED→NORESPONSE. If you are still encountering this issue on the latest Xamarin.iOS, please don’t hesitate to reopen the ticket with the requested information. Thanks!
Comment 6 Kent 2017-07-26 07:03:33 UTC
Um, was this closed automatically? I was not asked for a response. In fact, a repro had been confirmed. Re-opening.