Skip to content

Java invocation failure with master/15.6 #1187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alanmcgovern opened this issue Jan 12, 2018 · 5 comments
Closed

Java invocation failure with master/15.6 #1187

alanmcgovern opened this issue Jan 12, 2018 · 5 comments
Assignees
Labels
Area: App Runtime Issues in `libmonodroid.so`. regression
Milestone

Comments

@alanmcgovern
Copy link

With the latest master/15.6 builds of X.A i am triggering this issue inside the forms previewer:

Java.Lang.InstantiationException: android.view.ViewGroup
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <808e27c157614d6b865c43847235b62d>:0 
  at Java.Interop.JniEnvironment+Object.AllocObject (Java.Interop.JniObjectReference type) [0x0003c] in <8e80eb3ca41f4c3eb745bd7c73458796>:0 
  at Java.Interop.JniType.AllocObject () [0x0000c] in <8e80eb3ca41f4c3eb745bd7c73458796>:0 
  at Java.Interop.JniPeerMembers+JniInstanceMethods.StartCreateInstance (System.String constructorSignature, System.Type declaringType, Java.Interop.JniArgumentValue* parameters) [0x0003e] in <8e80eb3ca41f4c3eb745bd7c73458796>:0 
  at Android.Views.ViewGroup..ctor (Android.Content.Context context) [0x0005b] in <9ca7528089f0437883d939fbe90c65ab>:0 
  at Xamarin.Forms.Platform.Android.PlatformRenderer..ctor (Android.Content.Context context, Xamarin.Forms.Platform.Android.IPlatformLayout canvas) [0x00000] in C:\Users\hartez\Documents\Xamarin\Xamarin.Forms\Xamarin.Forms.Platform.Android\PlatformRenderer.cs:16

The code in question is the chaining to the base constructor here https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.Android/PlatformRenderer.cs#L16

The latest stable release of X.A works fine, so this looks like a regression between then and now.

@alanmcgovern alanmcgovern added this to the d15-6 milestone Jan 12, 2018
@grendello grendello added the Area: App Runtime Issues in `libmonodroid.so`. label Jan 12, 2018
@jonpryor
Copy link
Member

@alanmcgovern: Could you provide more output? That's an exception being thrown from Java.

@alanmcgovern
Copy link
Author

There is no more output unfortunately

@jonpryor
Copy link
Member

@alanmcgovern: normally a Java-side exception will contain the Java-side stack trace, but there isn't one being shown here.

There also aren't any repro instructions, I don't know how to recreate this behavior.

Without the Java-side exception, it's hard to reason about what could be going wrong. :-(

@jonpryor
Copy link
Member

@alanmcgovern: Please try the following code in a codepath "somewhere before" PlatformRenderer is created:

var g = Type.GetType("Xamarin.Forms.Platform.Android.PlatformRenderer, Xamarin.Forms.Platform.Android")
var m = (JniPeerMembers) g.GetField("_members", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue (null);
var ctors = (JniPeerMembers.JniInstanceMethods) m.InstanceMethods.GetType().GetMethod ("GetConstructorsForType", BindingFlags.NonPublic | BindingFlags.Instance).Invoke (m.InstanceMethods, new[]{g});
var dt = (Type) ctors.GetType().GetField("DeclaringType", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(ctors);
Console.WriteLine($"# jonp: ctors.DeclaringType={dt.FullName}"); 
var pt = (JniType) ctors.GetType().GetProperty("JniPeerType", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(ctors);
Console.WriteLine($"# jonp: ctors.JniPeerType={pt.Name}");

@jonpryor
Copy link
Member

We believe that this is a duplicate of Issue #1149. Please try with d15-6 Preview 4 installers, Xamarin.Android 8.2.0.9 or later.

jonpryor added a commit to jonpryor/xamarin-android that referenced this issue Mar 30, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jun 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: App Runtime Issues in `libmonodroid.so`. regression
Projects
None yet
Development

No branches or pull requests

4 participants