Skip to content

Commit ac50825

Browse files
committed
Account for by-ref-ness in MethodSignatureComparer.EqualSignatureTypes
1 parent d294f4c commit ac50825

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Castle.Core/DynamicProxy/Generators/MethodSignatureComparer.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,17 @@ public bool EqualReturnTypes(MethodInfo x, MethodInfo y)
103103

104104
private bool EqualSignatureTypes(Type x, Type y)
105105
{
106+
if (x.IsByRef != y.IsByRef)
107+
{
108+
return false;
109+
}
110+
else if (x.IsByRef)
111+
{
112+
// If `x` or `y` are by-ref generic types or type parameters (think `ref T` or `out T`),
113+
// the tests below would report false, so we need to erase by-ref-ness first:
114+
return EqualSignatureTypes(x.GetElementType(), y.GetElementType());
115+
}
116+
106117
if (x.IsGenericParameter != y.IsGenericParameter)
107118
{
108119
return false;

0 commit comments

Comments
 (0)