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