[fix] 修复计算 MonoPInvokeCallback的CallingConvention时,如果delegate在其他程序集中定义,会被错误当作Winapi,导致wrapper签名计算错误的bug
parent
d431aeb019
commit
fc685a99ca
|
@ -404,7 +404,7 @@ namespace HybridCLR.Editor.MethodBridge
|
|||
TypeDef delegateTypeDef;
|
||||
if (delegateTypeSig is ClassSig classSig)
|
||||
{
|
||||
delegateTypeDef = classSig.TypeDef;
|
||||
delegateTypeDef = classSig.TypeDefOrRef.ResolveTypeDefThrow();
|
||||
}
|
||||
else if (delegateTypeSig is GenericInstSig genericInstSig)
|
||||
{
|
||||
|
@ -412,12 +412,12 @@ namespace HybridCLR.Editor.MethodBridge
|
|||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException($"Unsupported delegate type {delegateTypeSig.GetType()}");
|
||||
delegateTypeDef = null;
|
||||
}
|
||||
|
||||
if (delegateTypeDef == null)
|
||||
{
|
||||
return CallingConvention.Winapi;
|
||||
throw new NotSupportedException($"Unsupported delegate type: {delegateTypeSig}");
|
||||
}
|
||||
var attr = delegateTypeDef.CustomAttributes.FirstOrDefault(ca => ca.AttributeType.FullName == "System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute");
|
||||
if (attr == null)
|
||||
|
|
Loading…
Reference in New Issue