Merge pull request #78877 from mattdiener/master

C# Fix deserialization of delegates that are 0-parameter overloads
This commit is contained in:
Yuri Sizov 2023-07-12 15:09:36 +02:00
commit e4c89a0278
1 changed files with 7 additions and 14 deletions

View File

@ -500,24 +500,17 @@ namespace Godot
Type? returnType = hasReturn ? DeserializeType(reader) : typeof(void);
int parametersCount = reader.ReadInt32();
var parameterTypes = parametersCount == 0 ? Type.EmptyTypes : new Type[parametersCount];
if (parametersCount > 0)
for (int i = 0; i < parametersCount; i++)
{
var parameterTypes = new Type[parametersCount];
for (int i = 0; i < parametersCount; i++)
{
Type? parameterType = DeserializeType(reader);
if (parameterType == null)
return false;
parameterTypes[i] = parameterType;
}
methodInfo = declaringType.GetMethod(methodName, (BindingFlags)flags, null, parameterTypes, null);
return methodInfo != null && methodInfo.ReturnType == returnType;
Type? parameterType = DeserializeType(reader);
if (parameterType == null)
return false;
parameterTypes[i] = parameterType;
}
methodInfo = declaringType.GetMethod(methodName, (BindingFlags)flags);
methodInfo = declaringType.GetMethod(methodName, (BindingFlags)flags, null, parameterTypes, null);
return methodInfo != null && methodInfo.ReturnType == returnType;
}