Bug 45998 - Regression: crash on dynamic method invocation
Summary: Regression: crash on dynamic method invocation
Status: CONFIRMED
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler (show other bugs)
Version: 7.0 (C8)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Habersack
URL:
Depends on:
Blocks:
 
Reported: 2016-10-27 12:08 UTC by aspyct
Modified: 2016-10-28 21:47 UTC (History)
4 users (show)

See Also:
Tags:
Is this bug a regression?: Yes
Last known good build: 6.1.2


Attachments
Minimal project recreating the crash (33.80 KB, application/zip)
2016-10-27 12:08 UTC, aspyct
Details

Description aspyct 2016-10-27 12:08:15 UTC
Created attachment 18247 [details]
Minimal project recreating the crash

Xamarin.Android 7.1 broke something that was working in 6.1.2.

Reproduce scenario:
- Open attached solution, "crash.zip"
- Restore packages
- Compile in Release configuration, run on device
- Put application to background (hit home button)

The app crashes, with the following stacktrace:

> [Timeline] Timeline: Activity_idle id: android.os.BinderProxy@230f7e31 time:838017155
> [MonoDroid] UNHANDLED EXCEPTION:
> [MonoDroid] System.MethodAccessException: Method `(wrapper dynamic-method) object:dynamic_callback_0 (intptr,intptr)' is inaccessible from method `ViewPagerIndicator.CirclePageIndicator/SavedState:InitializeCreator ()'
> [MonoDroid]   at (wrapper managed-to-native) Java.Interop.NativeMethods:java_interop_jnienv_alloc_object (intptr,intptr&,intptr)
> [MonoDroid]   at Java.Interop.JniEnvironment+Object.AllocObject (Java.Interop.JniObjectReference type) [0x0002b] in <740943ced51d45a1aa32400d7b329b35>:0 
> [MonoDroid]   at Java.Interop.JniType.AllocObject () [0x0000d] in <740943ced51d45a1aa32400d7b329b35>:0 
> [MonoDroid]   at Java.Interop.JniPeerMembers+JniInstanceMethods.StartCreateInstance (System.String constructorSignature, System.Type declaringType, Java.Interop.JniArgumentValue* parameters) [0x0004e] in <740943ced51d45a1aa32400d7b329b35>:0 
> [MonoDroid]   at Android.Views.View+BaseSavedState..ctor (Android.OS.IParcelable superState) [0x00068] in <26ca8b51d7b24fbf8dc6dff09349aa6e>:0 
> [MonoDroid]   at ViewPagerIndicator.CirclePageIndicator+SavedState..ctor (Android.OS.IParcelable superState) [0x00000] in <9e187c06bb8c4c57a0c4108bed24a3d9>:0 
> [MonoDroid]   at ViewPagerIndicator.CirclePageIndicator.OnSaveInstanceState () [0x00006] in <9e187c06bb8c4c57a0c4108bed24a3d9>:0 
> [MonoDroid]   at Android.Views.View.n_OnSaveInstanceState (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <26ca8b51d7b24fbf8dc6dff09349aa6e>:0 
> [MonoDroid]   at (wrapper dynamic-method) System.Object:600bd54d-962b-4107-ab9d-239b901e2496 (intptr,intptr)
> [mono-rt] Stacktrace:
> [mono-rt] 
> [mono-rt]   at <unknown> <0xffffffff>
> [mono-rt]   at (wrapper managed-to-native) Java.Interop.NativeMethods.java_interop_jnienv_find_class (intptr,intptr&,string) <0x00043>
> [mono-rt]   at Java.Interop.JniEnvironment/Types.FindClass (string) <0x000a7>
> [mono-rt]   at Java.Interop.JniType..ctor (string) <0x0002b>
> [mono-rt]   at Java.Interop.JniPeerMembers/JniInstanceMethods..ctor (System.Type) <0x000eb>
> [mono-rt]   at Java.Interop.JniPeerMembers/JniInstanceMethods.GetConstructorsForType (System.Type) <0x00097>
> [mono-rt]   at Java.Interop.JniPeerMembers/JniInstanceMethods.StartCreateInstance (string,System.Type,Java.Interop.JniArgumentValue*) <0x0009b>
> [mono-rt]   at Java.Lang.Throwable..ctor (string) <0x0016b>
> [mono-rt]   at Android.Runtime.JavaProxyThrowable..ctor (System.Exception) <0x0001f>
> [mono-rt]   at Java.Lang.Throwable.FromException (System.Exception) <0x0009f>
> [mono-rt]   at Android.Runtime.AndroidEnvironment.UnhandledException (System.Exception) <0x00173>
> [mono-rt]   at (wrapper dynamic-method) object.600bd54d-962b-4107-ab9d-239b901e2496 (intptr,intptr) <0x00063>
> [mono-rt]   at (wrapper native-to-managed) object.600bd54d-962b-4107-ab9d-239b901e2496 (intptr,intptr) <0x000b3>

Hint:
It seems that enabling the full debug symbols in Release configuration (double click project, Build / Compiler / General options / Debug information = Full) fixes the problem.
However, when archiving the app for publishing, the symbols seem to be stripped anyway, so it keeps crashing.

Workaround:
- Reinstall Xamarin.Android 6.1.2 from https://store.xamarin.com/account/my/subscription/downloads
Comment 1 aspyct 2016-10-27 12:17:06 UTC
Correction: It crashes on 7.0.1.3.

Note You need to log in before you can comment on or make changes to this bug.