Linker and LayoutInflater.Inflate(int, Android.Views.ViewGroup)

Viewed 306

i use Mvx.MvxFrameControl successfully with most views. One of these views uses a custom control built from scratch. In release mode only, while inflating this view, the app crashes.

The log shows that a method has been optimized away and is missing.

at <unknown> <0xffffffff>
at (wrapper managed-to-native) object.wrapper_native_...
at Android.Runtime.JNIEnv.CallObjectMethod (intptr,intptr,Android.Runtime.JValue[])
at Android.Views.LayoutInflater.Inflate(int, Android.Views.ViewGroup)
at Cirrious.MvvmCross.Binding.Droid.BindingContext.MvxAndroidBindingContext.CommonInflate(int,Android.View.ViewGroup, IMvxLayoutInfactorFactory)
....

So i tried to add these lines to the MainApp constructor in the MainApp class.

public class MainApp : Application
{
    public MainApp(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
    {
        //For linker only
        Android.Views.LayoutInflater inflater = null;
        if(inflater != null)
            inflater.Inflate(0, null);
    }

I was hoping the linker would not optimize the method away. But no luck. The method is still missing. How to fix this ?

EDIT: I've tryed Cheesebaron.HorizontalListView.Demo project in release mode in the Android 4.3 simulator and it aslo crashes.

EDIT: it seems the linking problem is related to all classes deriving from AdatperView<T>

EDIT: more stacktrace

01-03 03:20:46.185 E/mono-rt ( 2106): Stacktrace:
01-03 03:20:46.185 E/mono-rt ( 2106): 
01-03 03:20:46.195 E/mono-rt ( 2106):   at <unknown> <0xffffffff>
01-03 03:20:46.195 E/mono-rt ( 2106):   at (wrapper managed-to-native)    object.wrapper_native_0xb6360af0 (intptr,intptr,intptr,Android.Runtime.JValue[]) <0xffffffff>
01-03 03:20:46.195 E/mono-rt ( 2106):   at Android.Runtime.JNIEnv.CallObjectMethod     (intptr,intptr,Android.Runtime.JValue[]) <0x00068>
01-03 03:20:46.195 E/mono-rt ( 2106):   at Android.Views.LayoutInflater.Inflate (int,Android.Views.ViewGroup) <0x00147>
1 Answers
Related