adding better error message for ResolveMethod (#1950)

This commit is contained in:
James Frowen 2020-05-31 18:35:22 +01:00 committed by GitHub
parent e736f41470
commit e6311ecb37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,12 @@ public static MethodReference ResolveMethod(TypeReference tr, AssemblyDefinition
Weaver.Error($"Cannot resolve method {name} without a class");
return null;
}
return ResolveMethod(tr, scriptDef, method => method.Name == name);
MethodReference method = ResolveMethod(tr, scriptDef, m => m.Name == name);
if (method == null)
{
Weaver.Error($"Method not found with name {name} in type {tr.Name}", tr);
}
return method;
}
public static MethodReference ResolveMethod(TypeReference t, AssemblyDefinition scriptDef, System.Func<MethodDefinition, bool> predicate)