Bug 40672 - Assertion at ../../../../../mono/mono/mini/aot-runtime.c:4268, condition `klass->inited' not met when stepping in
Summary: Assertion at ../../../../../mono/mono/mini/aot-runtime.c:4268, condition `kla...
Alias: None
Product: iOS
Classification: Xamarin
Component: Mono runtime / AOT compiler ()
Version: XI 9.8 (tvOS / C7)
Hardware: PC Mac OS
: --- normal
Target Milestone: Future Cycle (TBD)
Assignee: Zoltan Varga
Depends on:
Reported: 2016-04-25 14:52 UTC by Chris Hamons
Modified: 2016-09-08 08:15 UTC (History)
7 users (show)

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

Repro (748.15 KB, application/zip)
2016-05-10 21:12 UTC, Chris Hamons

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 Chris Hamons 2016-04-25 14:52:52 UTC
Error/Crash - https://gist.github.com/chamons/21ce201b8870704eb6792d4bf8a6e76a
Machine Info - https://gist.github.com/chamons/cc7eb0558dbb26ae355dd5b0d481ee09

Steps to reproduce:

- Unzip attached project
- Run iOSApp on device
- Stick breakpoint on XamarinPlayground/iOSApp/ViewController.cs starting on line 28
- Step until you get to line 30, then step in
- Boom
Comment 1 Sebastien Pouliot 2016-05-10 21:01:48 UTC
@Chris you did not attach anything
Comment 2 Chris Hamons 2016-05-10 21:12:55 UTC
Created attachment 15960 [details]
Comment 3 Chris Hamons 2016-05-10 21:13:47 UTC
Fixed. My bad.
Comment 4 Michael Rumpler 2016-07-13 13:52:48 UTC
I get the same error in my Xamarin.Forms app. I tried to debug it, but the exception happens when I try to call one of my extension methods to string. So it's totally different from where it happens in Chris' code. It is also in a class which I didn't change in a while. So this worked fine before.

2016-07-13 15:00:14.342 RoyalTSiPro[2150:1852913] error: * Assertion at ../../../../../mono/mono/mini/aot-runtime.c:4268, condition `klass->inited' not met
2016-07-13 15:00:14.342 RoyalTSiPro[2150:1852913] critical: Stacktrace:
2016-07-13 15:00:14.343 RoyalTSiPro[2150:1852913] critical: 
Native stacktrace:
2016-07-13 15:00:14.716 RoyalTSiPro[2150:1852913] critical: 	0   RoyalTSiPro                         0x0004b49d mono_handle_native_sigsegv + 240
2016-07-13 15:00:14.717 RoyalTSiPro[2150:1852913] critical: 	1   libsystem_platform.dylib            0x2513d85f _sigtramp + 42
2016-07-13 15:00:14.717 RoyalTSiPro[2150:1852913] critical: 	2   libsystem_pthread.dylib             0x25141b47 pthread_kill + 62
2016-07-13 15:00:14.717 RoyalTSiPro[2150:1852913] critical: 	3   libsystem_c.dylib                   0x250300c5 abort + 108
2016-07-13 15:00:14.717 RoyalTSiPro[2150:1852913] critical: 	4   RoyalTSiPro                         0x000fc050 _ZL12log_callbackPKcS0_S0_iPv + 80
2016-07-13 15:00:14.718 RoyalTSiPro[2150:1852913] critical: 	5   RoyalTSiPro                         0x000ed57f log_adapter + 158
2016-07-13 15:00:14.718 RoyalTSiPro[2150:1852913] critical: 	6   RoyalTSiPro                         0x000f6f7f monoeg_assertion_message + 82
2016-07-13 15:00:14.718 RoyalTSiPro[2150:1852913] critical: 	7   RoyalTSiPro                         0x00028b1d mono_aot_get_method + 1548
2016-07-13 15:00:14.719 RoyalTSiPro[2150:1852913] critical: 	8   RoyalTSiPro                         0x0003a529 set_breakpoint + 396
2016-07-13 15:00:14.719 RoyalTSiPro[2150:1852913] critical: 	9   RoyalTSiPro                         0x0003af1d ss_start + 892
2016-07-13 15:00:14.719 RoyalTSiPro[2150:1852913] critical: 	10  RoyalTSiPro                         0x00037cc7 debugger_thread + 21426
2016-07-13 15:00:14.719 RoyalTSiPro[2150:1852913] critical: 	11  RoyalTSiPro                         0x000ef6f3 inner_start_thread + 260
2016-07-13 15:00:14.720 RoyalTSiPro[2150:1852913] critical: 	12  libsystem_pthread.dylib             0x25140c7f <redacted> + 138
2016-07-13 15:00:14.720 RoyalTSiPro[2150:1852913] critical: 	13  libsystem_pthread.dylib             0x25140bf3 _pthread_start + 110
2016-07-13 15:00:14.720 RoyalTSiPro[2150:1852913] critical: 	14  libsystem_pthread.dylib             0x2513ea08 thread_start + 8
2016-07-13 15:00:14.720 RoyalTSiPro[2150:1852913] critical: 
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.

I use Xamarin.Forms

Microsoft Visual Studio Enterprise 2015, Version 14.0.25123.00 Update 2
Xamarin (a9c7826)
Xamarin.iOS (be25da5)

On my Mac I have:

Version: (Visual Studio Professional)
Hash: 3cf8aae
Branch: c7sr0
Build date: 2016-06-20 16:09:58-0400

Build Information
Release ID: 600010009
Git revision: e879ce52093257c5c386ad7e390dfaa937fa7f90
Build date: 2016-06-24 11:53:43-04
Xamarin addins: a9252e6df4851fbbed1f9c6228e7b6dd1b475ac5
Build lane: monodevelop-lion-cycle7-sr0

Somebody else also reported this error in Xamarin.iOS https://forums.xamarin.com/discussion/71056/app-crashes

And another user in Xamarin.Forms, but he used Xamarin Studio https://forums.xamarin.com/discussion/70995/assertion-at-mono-mono-mini-aot-runtime-c-4268-condition-klass-inited-not-met
Comment 5 Rodrigo Kumpera 2016-07-13 15:24:20 UTC
Hey Zoltan,

Could you take a look at this one?
Comment 6 Michael Rumpler 2016-07-13 15:34:00 UTC
It seems to happen only when I debug.
If I start the app with F5 in VS and I place a breakpoint on the call to my method, then the breakpoint will be hit. If I then press F11 to step into the method, then it jumps to the first "{" of the method. Another F11 crashes the app.
If I hit the first breakpoint outside of the method and press F5, then the cursor jumps to another breakpoint within the method and it crashes later.
All the code I'm talking about is in a PCL project.

If I start the app on the iPad directly without debugging, then it works.
Comment 7 Zoltan Varga 2016-07-13 18:04:34 UTC
I cannot make the test app work, this line throws a nullref:

			TakePhotoButton.TouchDown += OnTakePhotoPressed;
Comment 8 Zoltan Varga 2016-07-13 18:13:48 UTC
I can't repro this with c8.
Comment 9 Zoltan Varga 2016-07-13 18:17:21 UTC
Setting as FIXED.

Note that you have to change ViewController.cs:15 to:

		public override void ViewDidLoad ()
Comment 10 Zoltan Varga 2016-07-13 18:23:52 UTC
Cannot reproduce with either.
Comment 12 Zoltan Varga 2016-07-31 04:12:01 UTC
Should be fixed by mono 8c8e1f6dfeeebe0d293e4c11ed5b82a303eba49e. That was backported to 4.6 as 2cac09666c04914ea74a3e2f39e5dfbd66be1293.