File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -559,6 +559,11 @@ private static CallingConvention GetCallingConvention(MethodDef method)
559559 {
560560 return CallingConvention . Winapi ;
561561 }
562+ if ( monoPInvokeCallbackAttr . ConstructorArguments . Count == 0 )
563+ {
564+ Debug . LogError ( $ "MonoPInvokeCallbackAttribute on method { method . FullName } has no constructor arguments. Using CallingConvention.Winapi as default.") ;
565+ return CallingConvention . Winapi ;
566+ }
562567 object delegateTypeSig = monoPInvokeCallbackAttr . ConstructorArguments [ 0 ] . Value ;
563568
564569 TypeDef delegateTypeDef ;
@@ -580,7 +585,7 @@ private static CallingConvention GetCallingConvention(MethodDef method)
580585 throw new NotSupportedException ( $ "Unsupported delegate type: { delegateTypeSig } ") ;
581586 }
582587 var attr = delegateTypeDef . CustomAttributes . FirstOrDefault ( ca => ca . AttributeType . FullName == "System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute" ) ;
583- if ( attr == null )
588+ if ( attr == null || attr . ConstructorArguments . Count == 0 )
584589 {
585590 return CallingConvention . Winapi ;
586591 }
You can’t perform that action at this time.
0 commit comments