Skip to content

[TrimmableTypeMap] Fix generated constructor UCO methods #11295

@simonrozsival

Description

@simonrozsival

I noticed we're invoking the wrong constructors in the generated IL, for example:

// ILSpy output:

// _TypeMap.Proxies.Android_Runtime_JavaProxyThrowable_Proxy
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Android.Runtime;
using Java.Interop;
using Java.Lang;

[UnmanagedCallersOnly]
public static void nctor_1_uco(System.IntPtr P_0, System.IntPtr P_1, System.IntPtr P_2, System.IntPtr P_3, byte P_4, byte P_5)
{
	//IL_0029: Unknown result type (might be due to invalid IL or missing references)
	JniTransition val = default(JniTransition);
	JniRuntime val2 = default(JniRuntime);
	if (!JniEnvironment.BeginMarshalMethod(P_0, ref val, ref val2))
	{
		return;
	}
	try
	{
		if (!JavaPeerProxy.ShouldSkipActivation(P_1))
		{
			// we are not resolving P_1, P_2, P_3!
			((Error)(JavaProxyThrowable)RuntimeHelpers.GetUninitializedObject(typeof(JavaProxyThrowable)))..ctor(P_1, (JniHandleOwnership)0); // we are calling the wrong constructor! we should be calling the one with the 5 parameters here!
		}
	}
	catch (System.Exception ex)
	{
		if (val2 != null)
		{
			val2.OnUserUnhandledException(ref val, ex);
		}
	}
	finally
	{
		JniEnvironment.EndMarshalMethod(ref val);
	}
}

Metadata

Metadata

Labels

bugComponent does not function as intended.needs-triageIssues that need to be assigned.trimmable-type-map

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions