Bug 39812 - Missing JNI constructor in IMenuItemInvoker
Summary: Missing JNI constructor in IMenuItemInvoker
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Radek Doulik
Depends on:
Reported: 2016-03-21 15:35 UTC by Przemysław Raciborski
Modified: 2017-10-04 15:13 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 Przemysław Raciborski 2016-03-21 15:35:25 UTC
System.NotSupportedExceptionUnable to activate instance of type Android.Views.IMenuItemInvoker from native handle 0xfe50001d (key_handle 0x6cc3aa9).

  at Java.Interop.TypeManager.CreateInstance (IntPtr handle, JniHandleOwnership transfer, System.Type targetType) [0x001a4] in <filename unknown>:0 
  at Java.Lang.Object.GetObject (IntPtr handle, JniHandleOwnership transfer, System.Type type) [0x000e5] in <filename unknown>:0 
  at Java.Lang.Object._GetObject[T] (IntPtr handle, JniHandleOwnership transfer) [0x0001a] in <filename unknown>:0 
  at Java.Lang.Object.GetObject[T] (IntPtr handle, JniHandleOwnership transfer) [0x00000] in <filename unknown>:0 
  at Android.Views.IMenuInvoker.FindItem (Int32 id) [0x00059] in <filename unknown>:0 
  at CashRush.Droid.MainActivity.OnCreateOptionsMenu (IMenu menu) [0x00025] in <filename unknown>:0 
  at Android.App.Activity.n_OnCreateOptionsMenu_Landroid_view_Menu_ (IntPtr jnienv, IntPtr native__this, IntPtr native_menu) [0x00011] in <filename unknown>:0 
  at (wrapper dynamic-method) System.Object:b586121b-16ef-4f99-a71e-99776a5127c6 (intptr,intptr,intptr)

System.MissingMethodExceptionNo constructor found for Android.Views.IMenuItemInvoker::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership)

  at Java.Interop.TypeManager.CreateProxy (System.Type type, IntPtr handle, JniHandleOwnership transfer) [0x00058] in <filename unknown>:0 
  at Java.Interop.TypeManager.CreateInstance (IntPtr handle, JniHandleOwnership transfer, System.Type targetType) [0x0012c] in <filename unknown>:0 

Java.Lang.ErrorException of type 'Java.Interop.JavaLocationException' was thrown.

Looks there is missing JNI constructor inside "IMenuItemInvoker". This constructor should be provided as MenuItem is touched by Android activity lifecycle. 

I suspect IMenuItemInvoker is internal JNI binding helper class located inside something like "MenuItem".
Comment 1 Jonathan Pryor 2016-03-22 22:51:53 UTC
Is this a Debug or Release app?

The IMenuItemInvoker(IntPtr, JniHandleOwnership) constructor *should* be present. Perhaps it's a linker bug in Release builds?
Comment 2 Przemysław Raciborski 2016-03-23 07:13:36 UTC
It's release build with SDK assemblies linking.
Comment 3 Jon Douglas [MSFT] 2017-10-04 15:13:28 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Android. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.