Bug 4592 - Various samples throwing 'System.Reflection.TargetInvocationException' on Release configuration
Summary: Various samples throwing 'System.Reflection.TargetInvocationException' on Rel...
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.1.x
Hardware: PC Mac OS
: Highest blocker
Target Milestone: ---
Assignee: Atsushi Eno
URL:
Depends on:
Blocks:
 
Reported: 2012-04-23 10:41 UTC by PJ
Modified: 2014-01-21 09:54 UTC (History)
4 users (show)

Tags:
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:
Status:
VERIFIED FIXED

Description PJ 2012-04-23 10:41:48 UTC
Application does not launch successfully as throwing exception. Hence, marking this test case as failed. Below is the report for the same.

Report:

Objective:
Application does not launch successfully as throwing exception'System.Reflection.TargetInvocationException'.

Steps to reproduce:
1. Open 'ExportAttributesTest'

Actual result:
Application does not launch successfully as throwing exception 'System.Reflection.TargetInvocationException'

Expected result:
Application should launch successfully.

Supplemental information:

Trace error:
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: An exception was thrown by the type initializer for Java.Interop.DynamicInvokeTypeInfo ---> System.InvalidOperationException: Mono for Android bug: JNIEnv type contains incompatible method signatures : XmlPullParserReader.FromJniHandle
E/mono (23519): at Java.Interop.DynamicInvokeTypeInfo.CheckReflection (System.Reflection.MethodInfo mi, System.String name) [0x00000] in <filename unknown>:0
E/mono (23519): at Java.Interop.DynamicInvokeTypeInfo..cctor () [0x00000] in <filename unknown>:0
E/mono (23519): --- End of inner exception stack trace ---
E/mono (23519): at Java.Interop.DynamicCallbackCodeGenerator..ctor (System.Reflection.MethodInfo method) [0x00000] in <filename unknown>:0
E/mono (23519): at Java.Interop.DynamicCallbackCodeGenerator.Create (System.Reflection.MethodInfo method) [0x00000] in <filename unknown>:0
E/mono (23519): at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.

Environment:
MonoDevelop-13c2b8900bc489291f789c8a41b44b04020a4a65
mono-android-4.1.1.188999709
Mac 10.7.3
Target framework 2.2 froyo
Device: LG P500
monodroid-4.1-preview branch
Comment 1 PJ 2012-04-23 10:43:19 UTC
Gesture Builder:

We are getting error 'System.Reflection.TargetInvocationException has been thrown' after open the application. Hence, marking this test case as failed. Below is the report.

Report:

Objective:
Application does not launch successfully as throwing exception'System.Reflection.TargetInvocationException has been thrown'.

Steps to reproduce:
1. Open 'GestureBuilder'.
2. Build the application
3. Run the application
4. Verify application does not launch successfully.
5. System.Reflection.TargetInvocationException has been thrown

Actual result:
Application does not launch successfully throwing exception 'System.Reflection.TargetInvocationException has been thrown'

Expected result:
Application should launch and run successfully.

Stack trace:
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: An exception was thrown by the type initializer for Java.Interop.DynamicInvokeTypeInfo ---> System.InvalidOperationException: Mono for Android bug: JNIEnv type contains incompatible method signatures : XmlPullParserReader.FromJniHandle
E/mono ( 9014): at Java.Interop.DynamicInvokeTypeInfo.CheckReflection (System.Reflection.MethodInfo mi, System.String name) [0x00000] in <filename unknown>:0
E/mono ( 9014): at Java.Interop.DynamicInvokeTypeInfo..cctor () [0x00000] in <filename unknown>:0
E/mono ( 9014): --- End of inner exception stack trace ---
E/mono ( 9014): at Java.Interop.DynamicCallbackCodeGenerator..ctor (System.Reflection.MethodInfo method) [0x00000] in <filename unknown>:0
E/mono ( 9014): at Java.Interop.DynamicCallbackCodeGenerator.Create (System.Reflection.MethodInfo method) [0x00000] in <filename unknown>:0
E/mono ( 9014): at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.

Environment:

mono-android-4.1.1.188999709
MonoDevelop-13c2b8900bc489291f789c8a41b44b04020a4a65
Mac 10.7.3
Device LG P500
Comment 2 PJ 2012-04-23 16:32:23 UTC
Think this is another one: WebViewJavascriptInterface


Application thrown exception 'System.Reflection.TargetInvocationException'.

Steps to reproduce:
1. Open 'WebViewJavaScriptInterface'.
2. Run the application.
3. Application does not launch successfully.
4.'System.Reflection.TargetInvocationException' thrown.

Actual result:
Application does not launch successfully throwing exception 'System.Reflection.TargetInvocationException'

Expected Result:
Application should launch successfully with 'ClickMe!' button.

Error trace:
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: An exception was thrown by the type initializer for Java.Interop.DynamicInvokeTypeInfo ---> System.InvalidOperationException: Mono for Android bug: JNIEnv type contains incompatible method signatures : XmlPullParserReader.FromJniHandle
E/mono (29303): at Java.Interop.DynamicInvokeTypeInfo.CheckReflection (System.Reflection.MethodInfo mi, System.String name) [0x00000] in <filename unknown>:0
E/mono (29303): at Java.Interop.DynamicInvokeTypeInfo..cctor () [0x00000] in <filename unknown>:0
E/mono (29303): --- End of inner exception stack trace ---
E/mono (29303): at Java.Interop.DynamicCallbackCodeGenerator..ctor (System.Reflection.MethodInfo method) [0x00000] in <filename unknown>:0
E/mono (29303): at Java.Interop.DynamicCallbackCodeGenerator.Create (System.Reflection.MethodInfo method) [0x00000] in <filename unknown>:0
E/mono (29303): at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.

mono-android-4.1.1.188999709
MonoDevelop-13c2b8900bc489291f789c8a41b44b04020a4a65
Mac 10.7.3
Device: LG P500
Target Framework: 2.2 Froyo
Comment 3 Atsushi Eno 2012-04-24 00:31:12 UTC
I just confirmed everything worked. They should work after df9a7a1 which fixed the regression brought by Android.Runtime API change (CallbackCode.cs should have been changed in sync).

If jonp made further changes without changing CallbackCode, then this kind of breakage would be back again, but I don't think there was such a change.

Are you really sure you have the latest *platform* apk? Make sure to have the latest apk by uninstalling and reinstalling it.
Comment 4 PJ 2012-04-24 11:21:01 UTC
Confirmed all these samples launch as expected (at least on this HTC Flyer).

Looks like you and jonp were correct, and I've reminded the team that cleaning the device is required between test runs. I've also now added it to the test guidelines I've been making, so it will happen reliably in the future.


I'll go check the API demo issue as well.
Comment 5 PJ 2012-04-24 14:02:44 UTC
Nischal was certain that the issue still manifested after cleaning the device, so I did some more thorough testing (instead of just one device/configuration).

I found that **the issue manifests only on Release configuration**, and the device doesn't seem to matter. (Repro'd on the device I originally saw the correct behavior on in comment 4)

Re-opening.
Comment 6 Jonathan Pryor 2012-04-24 17:17:38 UTC
Fixed in ac2da34f.
Comment 7 Atsushi Eno 2012-04-25 09:04:03 UTC
I've re-examined my testing and turned out that I was somehow also verifying those with *debug* builds and saw they succeed in wrong angle. Sorry for the confusion!
Comment 8 Prashant manu 2014-01-21 09:54:00 UTC
I have checked this issue with following builds:

All Mac
X.S 4.2.3(build 146)
Mono 3.2.6
X.Android 4.13.0-4

I am successfully able to deplloy and launch applications 'ExportAttributesTest', 'GestureBuilder', 'WebViewJavaScriptInterface' on devices.