Bug 49056 - Assertion at /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/external/mono/mono/mini/mini-generic-sharing.c:2351, condition `info' not met
Summary: Assertion at /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/ex...
Alias: None
Product: iOS
Classification: Xamarin
Component: Mono runtime / AOT compiler ()
Version: XI 10.2 (iOS 10.1)
Hardware: PC Mac OS
: --- normal
Target Milestone: (C9)
Assignee: Zoltan Varga
Depends on:
Reported: 2016-12-05 22:12 UTC by Jon Goldberger [MSFT]
Modified: 2018-02-07 16:09 UTC (History)
9 users (show)

Is this bug a regression?: Yes
Last known good build: Xamarin.iOS 9.8.2 with Xcode 8.0

Simple repro for Bug 49056 (678.86 KB, application/zip)
2016-12-20 05:07 UTC, Paul DB
ServiceStack lib source code for stack tracing purposes (7.40 MB, application/zip)
2016-12-20 05:17 UTC, Paul DB

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 Jon Goldberger [MSFT] 2016-12-05 22:12:58 UTC
## Description

Crash occurs on 32 bit devices only. 

From reporting customer ( I do not have access to code base to test myself at this time):

"Our team has recently run into an issue with our apps compiled using Xamarin.ios and Xcode 8.1, specifically with phones on the armv7 and armv7s architectures (anything iPhone 5 and lower). The apps will consistently crash on these devices - anything on armv64 works as expected. We spent a good amount of time trying to debug, but were unable to pinpoint the exact problem. The crash events are consistent – usually failing around specific network calls – but not completely explainable as other network calls would succeed without issue. We were not able to pull any crash logs, but do have the below error.

>2016-11-22 14:59:44.608 FoodKick[210:4659] error: * Assertion at /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/external/mono/mono/mini/mini-generic-sharing.c:2351, condition `info' not met

As a temporarily solution, we've reverted our builds back to Xamarin.iOS 9.8.2 with Xcode 8.0 and no longer see the issue. Are there any other records of similar issues? Because we aren't able to exactly locate the problem it could be something application specific, but we are rather sure there is some relationship to the build tools, as once we reverted it works as expected. Based on the error message, would you have any suggested work arounds for us to proceed with the latest version of Xamarin.iOS?"

## Version info (I have requested complete version info, but did not receive it yet, only the following is known at this time):

Xcode 8.1
Comment 2 Jon Goldberger [MSFT] 2016-12-05 22:23:21 UTC
Build, device, debug, and crash report logs added as a private attachment.
Comment 3 Jon Goldberger [MSFT] 2016-12-05 22:27:44 UTC
Possibly related bug #46528
Comment 4 Alex Soto [MSFT] 2016-12-08 06:56:49 UTC
@Zoltan do you think that the provided information + bug #46528 are enough to fix this issue?

@Jon unfortunately we are not able to replicate this issue, do you think you can get us a test case somehow?
Comment 5 Jon Goldberger [MSFT] 2016-12-08 19:29:24 UTC
Working on it.
Comment 6 Zoltan Varga 2016-12-09 01:32:47 UTC
That assertion can be caused by a lot of issues, so having a testcase would be very useful.
Comment 7 Paul DB 2016-12-20 05:06:51 UTC
Hi folks,

We're hitting the exact same problem as reported above, also on 32 bit iOS devices only.

Attached is a very simple repro of the problem - the case crashes in the 2 line AppDelegate.FinishedLaunching due to the ServiceStack TypeSerializer call we make there.

Interestingly in our actual product code, the rest of our ServiceStack calls seem to be working fine on 32bit up to the point where this particular line crashes the app.
It seems that this particular line or code path in the ServiceStack lib has the issue, which makes me suspect some kind of over-aggressive AOT optimisations?
64 bit devices work perfectly with this code.

The stack trace indicates the issue has roots within our ServiceStack library - however we have been using this successfully for years now.
To be sure it wasn't just a compile issue, we recompiled our ServiceStack libs from source code (also attached), but no change in the problem.

We're going to revert backwards to Xamarin.iOS 9.8.2 as the OP suggests in the hopes the issue is not present in that older version.

Hope the repro case attached helps!
Comment 8 Paul DB 2016-12-20 05:07:39 UTC
Created attachment 18932 [details]
Simple repro for Bug 49056
Comment 9 Paul DB 2016-12-20 05:17:21 UTC
Created attachment 18933 [details]
ServiceStack lib source code for stack tracing purposes

We use the dlls generated from the MonoTouch specific sln found at: 
Comment 10 Paul DB 2016-12-20 08:05:35 UTC
Can confirm that reverting to has cleared the issue.
The Xamarin spec below runs the repro and our product code on my iPad 3 without crashing.

Xamarin Studio Business
Version 6.1.2 (build 44)
Installation UUID: d8fba736-ad1a-4bd7-93af-8e6714dab746
	Mono 4.6.2 (mono-4.6.0-branch/08fd525) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 406020007


Not Installed

Apple Developer Tools
Xcode 8.0 (11246)
Build 8A218a

Version: (Xamarin Business)
Hash: f37444a
Branch: cycle7-sr1
Build date: 2016-07-28 12:17:02-0400
Comment 12 Zoltan Varga 2016-12-20 18:50:27 UTC
This is caused by an error handling failure, the real error is this:

Attempting to JIT compile method 'ServiceStack.Text.Common.ToStringDictionaryMethods`3<System.Guid, int, ServiceStack.Text.Jsv.JsvTypeSerializer>:WriteGenericIDictionary (System.IO.TextWriter,System.Collections.Generic.IDictionary`2<System.Guid, int>,ServiceStack.Text.Common.WriteObjectDelegate,ServiceStack.Text.Common.WriteObjectDelegate)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.
Comment 13 Zoltan Varga 2016-12-20 21:33:33 UTC
Thanks for the testcase.

The problem with the testcase should be fixed by this mono commit:


It might fix the original problem as well, if they are the same.
Comment 14 Paul DB 2016-12-20 22:59:03 UTC
Great, thanks!

Any idea when this commit can be picked up in a Xamarin.iOS update?
Comment 15 Zoltan Varga 2016-12-20 23:28:13 UTC
@rolf ?
Comment 16 Rolf Bjarne Kvinge [MSFT] 2016-12-21 10:41:34 UTC
@Paul, this will show up in one of the next cycle 9 (Xamarin.iOS v10.4) alphas (due to the upcoming holidays it probably won't happen until early next year).
Comment 17 Rolf Bjarne Kvinge [MSFT] 2016-12-21 10:53:31 UTC

master: https://github.com/xamarin/xamarin-macios/pull/1390
cycle9: https://github.com/xamarin/xamarin-macios/pull/1391
Comment 20 Shane Raiteri 2017-01-14 00:00:35 UTC
Thanks @rolf. 

For anyone else who has this as a release showstopper (and reverting back to Xamarin.iOS 9.8 is not an option), the fix is available in the Xamarin.iOS (Beta channel - cycle9 branch as @ 13/01/17). Only an issue on iOS devices running the 32-bit A6 chipset & earlier (http://iossupportmatrix.com/).

This is cut from https://github.com/xamarin/xamarin-macios/commit/a7f1dc3d54307c05e58bf349fdc6ad5137be2bba which includes the above cycle9 commit.