未验证 提交 486757d7 编写于 作者: W Wei Zheng 提交者: GitHub

Fix DispatchProxy not working with in parameters (#49214)

* Fix DispatchProxy not working with in parameters

* Correct typo
Co-authored-by: NChristopher Watford <christopher.watford@ge.com>

* Fixed Calling Convention

Removed unneeded mods
Co-authored-by: NChristopher Watford <christopher.watford@ge.com>
上级 d2cf6738
......@@ -394,9 +394,19 @@ internal void AddInterfaceImpl([DynamicallyAccessedMembers(DynamicallyAccessedMe
private MethodBuilder AddMethodImpl(MethodInfo mi, int methodInfoIndex)
{
ParameterInfo[] parameters = mi.GetParameters();
Type[] paramTypes = ParamTypes(parameters, false);
Type[] paramTypes = new Type[parameters.Length];
Type[][] paramReqMods = new Type[paramTypes.Length][];
for (int i = 0; i < parameters.Length; i++)
{
paramTypes[i] = parameters[i].ParameterType;
paramReqMods[i] = parameters[i].GetRequiredCustomModifiers();
}
MethodBuilder mdb = _tb.DefineMethod(mi.Name, MethodAttributes.Public | MethodAttributes.Virtual, CallingConventions.Standard,
mi.ReturnType, null, null,
paramTypes, paramReqMods, null);
MethodBuilder mdb = _tb.DefineMethod(mi.Name, MethodAttributes.Public | MethodAttributes.Virtual, mi.ReturnType, paramTypes);
if (mi.ContainsGenericParameters)
{
Type[] ts = mi.GetGenericArguments();
......
......@@ -603,6 +603,7 @@ public static void Invoke_Ref_Out_In_Method()
testRefOutInInvocation(p => p.Out(out _), null);
testRefOutInInvocation(p => p.OutAttribute(value), "Hello");
testRefOutInInvocation(p => p.Ref(ref value), "Hello");
testRefOutInInvocation(p => p.In(in value), "Hello");
}
private static void testRefOutInInvocation(Action<TestType_IOut_Ref> invocation, string expected)
......
......@@ -19,6 +19,7 @@ public interface TestType_IHelloService
public interface TestType_IOut_Ref
{
void In(in string message);
void Out(out string message);
void Ref(ref string message);
void InAttribute([In] string message);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册