Skip to content

Commit 8030c81

Browse files
committed
add generic method check
1 parent d4cf0db commit 8030c81

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/SourceGeneration.Reflection/SourceMethodInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public Type ReturnType
2525

2626
public Func<object?, object?[]?, object?> Invoke
2727
{
28-
get => _invoke ?? MethodInfo.Invoke;
28+
get => _invoke ?? (MethodInfo.IsGenericMethodDefinition ? throw new InvalidOperationException("This method has a generic parameter. Please use MethodInfo.Invoke instead.") : MethodInfo.Invoke);
2929
init => _invoke = value;
3030
}
3131
}

0 commit comments

Comments
 (0)