{"record":{"id":"c9de02e36bdd2cfa","repo":"egametang/ET","slug":"preservedmethod-method-has-generic-parameters","errorCode":null,"errorMessage":"[PreservedMethod] method has generic parameters","messagePattern":"\\[PreservedMethod\\] method has generic parameters","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Packages/cn.etetet.hybridclr/Scripts/Editor/Share/MethodBridge/Generator.cs","lineNumber":148,"sourceCode":"                    throw new Exception($\"[PreservedMethod] method:{methodDef} has generic parameters\");\n                }\n                paramInfos.Add(new ParamInfo() { Type = GetSharedTypeInfo(paramInfo) });\n            }\n            var mbs = new MethodDesc()\n            {\n                MethodDef = methodDef,\n                ReturnInfo = new ReturnInfo() { Type = returnType != null ? GetSharedTypeInfo(returnType) : TypeInfo.s_void },\n                ParamInfos = paramInfos,\n            };\n            return mbs;\n        }\n\n        private MethodDesc CreateMethodDesc(TypeSig returnType, List<TypeSig> parameters)\n        {\n            var paramInfos = new List<ParamInfo>();\n            if (returnType.ContainsGenericParameter)\n            {\n                throw new Exception($\"[PreservedMethod] method has generic parameters\");\n            }\n            foreach (var paramInfo in parameters)\n            {\n                if (paramInfo.ContainsGenericParameter)\n                {\n                    throw new Exception($\"[PreservedMethod] method has generic parameters\");\n                }\n                paramInfos.Add(new ParamInfo() { Type = GetSharedTypeInfo(paramInfo) });\n            }\n            var mbs = new MethodDesc()\n            {\n                MethodDef = null,\n                ReturnInfo = new ReturnInfo() { Type = returnType != null ? GetSharedTypeInfo(returnType) : TypeInfo.s_void },\n                ParamInfos = paramInfos,\n            };\n            return mbs;\n        }\n","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.hybridclr/Scripts/Editor/Share/MethodBridge/Generator.cs#L130-L166","documentation":"Thrown by the second CreateMethodDesc overload (the one without a MethodDef, used for synthetic/anonymous bridge methods) when returnType.ContainsGenericParameter is true. Unlike errors 193/194 this overload is for generated signatures that have no backing MethodDef, so the message omits the method name.","triggerScenarios":"CreateMethodDesc(TypeSig returnType, List<TypeSig> parameters) is called during generation of synthetic bridge methods (e.g. adjust-thunk or wrapper stubs) where the computed return type still contains a generic parameter, indicating the upstream inflation failed.","commonSituations":"A generic instantiation was not fully resolved before the synthetic method was created; GenericArgumentContext.Inflate left an open generic due to missing type arguments; a code path constructs a bridge signature from an uninstantiated generic method.","solutions":["Ensure GenericArgumentContext is populated with all needed class and method instantiations before calling this overload.","Run HybridCLR/Generate/AOTGenericReference to collect all instantiations, then regenerate bridges.","If this appears after a code change, review new generic method usage that crosses the AOT boundary."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (returnType != null && returnType.ContainsGenericParameter)\n    Debug.LogError(\"Synthetic method return type has open generic parameter -- inflation incomplete.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Populate GenericArgumentContext with all class and method instantiations before creating synthetic bridge signatures.","Run AOTGenericReference before MethodBridge generation.","Review generic API changes that introduce new managed/native boundary methods."],"tags":["hybridclr","method-bridge","generics","synthetic-method"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}