Bug 12609 - Linker option SDK Assemblies Only: SIGSEGV MvvmCross Xxx.Core assembly reflection
Summary: Linker option SDK Assemblies Only: SIGSEGV MvvmCross Xxx.Core assembly reflec...
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 4.7.x
Hardware: PC Windows
: High normal
Target Milestone: ---
Assignee: Rodrigo Kumpera
Depends on:
Reported: 2013-06-09 04:43 UTC by Arthur
Modified: 2013-06-25 22:23 UTC (History)
2 users (show)

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

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 Arthur 2013-06-09 04:43:58 UTC

Xamarin 4.7.6 (4.7.8 same results)
Test app: FirstDemo from https://github.com/slodge/NPlus1DaysOfMvvmCross

This app is a simple demo app for the MvvmCross libraries (MVVM methodology)
The app contains FirstDemo.Core (OS independent logic) and FirstDemo.Droid (OS dependent, UI etc.)
The framework makes use of Reflection to find and instantiate classes

In Xamarin 4.6.x the app could be compiled with Linker option SDK Only, resulting in a relatively small package.
Xamarin 4.7.6 linker (and up, not sure about 4.7.1) results in the app crashing:

Stack Dump:

06-09 16:31:48.996 F/        (10765): * Assertion at /Users/builder/data/lanes/monodroid-mlion-master/f42f3519/source/mono/mono/metadata/domain.c:1721, condition `mono_defaults.iunknown_class != 0' not met
06-09 16:31:48.996 E/mono-rt (10765): Stacktrace:
06-09 16:31:48.996 E/mono-rt (10765): 
06-09 16:31:48.996 E/mono-rt (10765):   at <unknown> <0xffffffff>
06-09 16:31:48.996 E/mono-rt (10765):   at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes (System.Reflection.Assembly,bool) <IL 0x0002e, 0xffffffff>
06-09 16:31:48.996 E/mono-rt (10765):   at System.Reflection.Assembly.GetTypes () <IL 0x00002, 0x00053>
06-09 16:31:48.996 E/mono-rt (10765):   at Cirrious.MvvmCross.Droid.Platform.MvxAndroidSetupSingleton.<FindSetupType>b__3 (System.Reflection.Assembly) <IL 0x00001, 0x0004f>
06-09 16:31:48.996 E/mono-rt (10765):   at System.Linq.Enumerable/<CreateSelectManyIterator>c__Iterator29`3.MoveNext () <IL 0x00066, 0x002bf>
06-09 16:31:48.996 E/mono-rt (10765):   at System.Linq.Enumerable/<CreateWhereIterator>c__Iterator33`1.MoveNext () <IL 0x00097, 0x003fb>
06-09 16:31:48.996 E/mono-rt (10765):   at System.Linq.Enumerable/<CreateWhereIterator>c__Iterator33`1.MoveNext () <IL 0x00097, 0x003fb>
06-09 16:31:48.996 E/mono-rt (10765):   at System.Linq.Enumerable/<CreateSelectIterator>c__Iterator25`2.MoveNext () <IL 0x0008c, 0x003d3>
06-09 16:31:48.996 E/mono-rt (10765):   at System.Linq.Enumerable.First<TSource> (System.Collections.Generic.IEnumerable`1<TSource>,System.Func`2<TSource, bool>,System.Linq.Enumerable/Fallback) <IL 0x00027, 0x0020f>
06-09 16:31:48.996 E/mono-rt (10765):   at System.Linq.Enumerable.FirstOrDefault<TSource> (System.Collections.Generic.IEnumerable`1<TSource>) <IL 0x0000d, 0x000a3>
06-09 16:31:48.996 E/mono-rt (10765):   at Cirrious.MvvmCross.Droid.Platform.MvxAndroidSetupSingleton.FindSetupType () <IL 0x000b1, 0x00453>
06-09 16:31:48.996 E/mono-rt (10765):   at Cirrious.MvvmCross.Droid.Platform.MvxAndroidSetupSingleton.GetOrCreateSetupImpl (Android.Content.Context) <IL 0x00031, 0x001c7>
06-09 16:31:48.996 E/mono-rt (10765):   at Cirrious.MvvmCross.Droid.Platform.MvxAndroidSetupSingleton.GetOrCreateSetup (Android.Content.Context) <IL 0x0000b, 0x00087>
06-09 16:31:48.996 E/mono-rt (10765):   at Cirrious.MvvmCross.Droid.Views.MvxSplashScreenActivity.OnCreate (Android.OS.Bundle) <IL 0x0000e, 0x0008f>
06-09 16:31:48.996 E/mono-rt (10765):   at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) <IL 0x00012, 0x000eb>
06-09 16:31:48.996 E/mono-rt (10765):   at (wrapper dynamic-method) object.f6ddead1-8add-4cad-bd56-5add51bac34f (intptr,intptr,intptr) <IL 0x00017, 0x00043>
06-09 16:31:48.996 E/mono-rt (10765):   at (wrapper native-to-managed) object.f6ddead1-8add-4cad-bd56-5add51bac34f (intptr,intptr,intptr) <IL 0x00023, 0xffffffff>
06-09 16:31:48.996 E/mono-rt (10765): 
06-09 16:31:48.996 E/mono-rt (10765): =================================================================
06-09 16:31:48.996 E/mono-rt (10765): Got a SIGSEGV while executing native code. This usually indicates
06-09 16:31:48.996 E/mono-rt (10765): a fatal error in the mono runtime or one of the native libraries 
06-09 16:31:48.996 E/mono-rt (10765): used by your application.
06-09 16:31:48.996 E/mono-rt (10765): =================================================================
Comment 1 Jonathan Pryor 2013-06-09 09:59:52 UTC

Are you trying to use COM Interop support?
Comment 2 Arthur 2013-06-10 02:25:48 UTC
No. No COM Interop.

This MvvmCross sample works well with current production version of Xamarin.
Comment 3 Jonathan Pryor 2013-06-19 15:50:35 UTC
Alex: the Linker is removing the Mono.Interop.IUnknown type. We should either preserve the Mono.Interop.IUnknown type, or disable COM.
Comment 5 Rodrigo Kumpera 2013-06-20 19:34:43 UTC
Fixed in mono on 3a489de4b8ed6c43188f8a438f9abb6a29aa1e6e. Now I need to bump MFA and see if any further fixes are needed.

In the meanwhile, MvvmCross should do the smart thing and not scan system libraries.
Comment 6 Jonathan Pryor 2013-06-25 22:23:55 UTC
Marking as fixed, as per Comment #5.