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

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

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

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 for Bug 45998 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

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] 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>

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.

- 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