{"record":{"id":"7439827b664218aa","repo":"pardeike/Harmony","slug":"unsupported-inline-signature-parameter-type-param-param","errorCode":null,"errorMessage":"Unsupported inline signature parameter type: {param} ({param?.GetType().FullDescription()})","messagePattern":"Unsupported inline signature parameter type: (.+?) \\((.+?)\\)","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"Harmony/Internal/InlineSignature.cs","lineNumber":48,"sourceCode":"\t\tpublic List<object> Parameters { get; set; } = [];\r\n\r\n\t\t/// <summary>The return type or function pointer signature returned by the call site</summary>\r\n\t\t///\r\n\t\tpublic object ReturnType { get; set; } = typeof(void);\r\n\r\n\t\t/// <summary>Returns a string representation of the inline signature</summary>\r\n\t\t/// <returns>A string representation of the inline signature</returns>\r\n\t\t///\r\n\t\tpublic override string ToString() => $\"{(ReturnType is Type rt ? rt.FullDescription() : ReturnType?.ToString())} ({Parameters.Join(p => p is Type pt ? pt.FullDescription() : p?.ToString())})\";\r\n\r\n\t\tinternal static TypeReference GetTypeReference(ModuleDefinition module, object param)\r\n\t\t{\r\n\t\t\treturn param switch\r\n\t\t\t{\r\n\t\t\t\tType paramType => module.ImportReference(paramType),\r\n\t\t\t\tInlineSignature paramSig => paramSig.ToFunctionPointer(module),\r\n\t\t\t\tModifierType paramMod => paramMod.ToTypeReference(module),\r\n\t\t\t\t_ => throw new NotSupportedException($\"Unsupported inline signature parameter type: {param} ({param?.GetType().FullDescription()})\"),\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tCallSite ICallSiteGenerator.ToCallSite(ModuleDefinition module)\r\n\t\t{\r\n\t\t\tvar callsite = new CallSite(GetTypeReference(module, ReturnType))\r\n\t\t\t{\r\n\t\t\t\tHasThis = HasThis,\r\n\t\t\t\tExplicitThis = ExplicitThis,\r\n\t\t\t\tCallingConvention = (MethodCallingConvention)CallingConvention - 1\r\n\t\t\t};\r\n\r\n\t\t\tforeach (var param in Parameters)\r\n\t\t\t\tcallsite.Parameters.Add(new ParameterDefinition(GetTypeReference(module, param)));\r\n\r\n\t\t\treturn callsite;\r\n\t\t}\r\n\r","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/pardeike/Harmony/blob/e7872dc17008bc0ca2b3de1f53fd4120dbd7a17c/Harmony/Internal/InlineSignature.cs#L30-L66","documentation":"InlineSignature builds call-site / function-pointer signatures for IL emission. GetTypeReference converts each parameter object (Type, InlineSignature, or ModifierType) into a Cecil TypeReference; any other object shape is unsupported and throws NotSupportedException naming the offending object and its runtime type.","triggerScenarios":"Constructing an InlineSignature (ToCallSite/ToFunctionPointer/callsite/fptr paths) with a parameter item that is not a System.Type, not an InlineSignature, and not a ModifierType — e.g. passing a raw string type name, null placeholder, or a custom signature element type.","commonSituations":"Hand-writing calli/function-pointer signatures for native or generic function pointers and using the wrong representation for a parameter; library-version drift where an element type was previously accepted.","solutions":["Pass a System.Type for normal parameter types instead of a string or custom object","Use InlineSignature for nested function-pointer parameters and ModifierType for modreq/modopt parameters","Check for null entries in the parameter list — the message prints the type only for non-null values","Upgrade Harmony if you believe a valid element kind is being rejected"],"exampleFix":"// before\nnew InlineSignature(typeof(void), \"int\", typeof(IntPtr));\n// after\nnew InlineSignature(typeof(void), typeof(int), typeof(IntPtr));","handlingStrategy":"type-guard","validationCode":"bool IsSupportedParam(object p) => p is Type or InlineSignature or ModifierType;","typeGuard":"static bool IsSupportedSignatureParam(object? param) => param is Type or InlineSignature or ModifierType;","tryCatchPattern":"try { var fptr = sig.ToFunctionPointer(module); }\ncatch (NotSupportedException ex) when (ex.Message.StartsWith(\"Unsupported inline signature parameter type\")) { /* inspect offending param type and fix construction */ }","preventionTips":["Only put Type, InlineSignature, or ModifierType objects in inline signature parameter lists","Never pass type names as strings into signatures","Validate signature element lists before calling ToCallSite/ToFunctionPointer"],"tags":["signatures","function-pointer","unsupported-type","harmony"],"backgroundTag":"unsupported-operation","analyzedSha":"e7872dc17008bc0ca2b3de1f53fd4120dbd7a17c","analyzedAt":"2026-09-15T22:47:11.550Z","contentChangedAt":"2026-09-15T22:47:11.550Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}