Skip to content

Commit 4182832

Browse files
authored
Merge pull request #1 from kartalm/master
unboxing implemented
2 parents c42b10c + 6fd7ab9 commit 4182832

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ProxyFactoryCore/Impl/DerivedProxyBuilder.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,15 @@ public Type CreateProxyType(Type baseType, IInterceptorConfiguration config)
377377

378378
ilGenerator.MarkLabel(finish);
379379

380+
if (methodInfo.ReturnType == typeof(void))
381+
{
382+
ilGenerator.Emit(OpCodes.Pop);
383+
}
384+
else if (methodInfo.ReturnType.IsPrimitive)
385+
{
386+
ilGenerator.Emit(OpCodes.Unbox_Any, methodInfo.ReturnType);
387+
}
388+
380389
ilGenerator.Emit(OpCodes.Ret);
381390

382391
_typeBuilder.DefineMethodOverride(derivedMethodBuilder, methodInfo);

0 commit comments

Comments
 (0)