Skip to content

GH-1881 - Fix interface method attributes when generating proxies #1882

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
wants to merge 7 commits into from
3 changes: 2 additions & 1 deletion src/NHibernate/Proxy/NHibernateProxyBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ private static void EmitCallBaseIfLazyInitializerIsNull(
if (method.DeclaringType.IsInterface &&
method.DeclaringType.IsAssignableFrom(parentType))
{
Delegate
var interfaceMap = parentType.GetInterfaceMap(method.DeclaringType);
var methodIndex = Array.IndexOf(interfaceMap.InterfaceMethods, method);
method = interfaceMap.TargetMethods[methodIndex];
Expand Down Expand Up @@ -462,7 +463,7 @@ private static void EmitCallBaseIfLazyInitializerIsNull(
*/

IL.Emit(OpCodes.Ldarg_0);
EmitCallMethod(IL, method.DeclaringType.IsInterface ? OpCodes.Callvirt : OpCodes.Call, method);
EmitCallMethod(IL, OpCodes.Call, method);
IL.Emit(OpCodes.Ret);
}

Expand Down