{"record":{"id":"5929af3f303b88c4","repo":"egametang/ET","slug":"type-a-definition-could-not-be-found","errorCode":null,"errorMessage":"type:{a} definition could not be found","messagePattern":"type:(.+?) definition could not be found","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Packages/cn.etetet.hybridclr/Scripts/Editor/Share/Meta/MetaUtil.cs","lineNumber":96,"sourceCode":"\t\t\t\tcase ElementType.U8: return corTypes.UInt64;\n\t\t\t\tcase ElementType.R4: return corTypes.Single;\n\t\t\t\tcase ElementType.R8: return corTypes.Double;\n\t\t\t\tcase ElementType.String: return corTypes.Object;\n\t\t\t\tcase ElementType.TypedByRef: return corTypes.TypedReference;\n\t\t\t\tcase ElementType.I: return corTypes.IntPtr;\n\t\t\t\tcase ElementType.U: return corTypes.UIntPtr;\n\t\t\t\tcase ElementType.Object: return corTypes.Object;\n\t\t\t\tcase ElementType.Sentinel: return typeSig;\n\t\t\t\tcase ElementType.Ptr: return corTypes.UIntPtr;\n\t\t\t\tcase ElementType.ByRef: return corTypes.UIntPtr;\n\t\t\t\tcase ElementType.SZArray: return corTypes.Object;\n\t\t\t\tcase ElementType.Array: return corTypes.Object;\n\t\t\t\tcase ElementType.ValueType:\n\t\t\t\t{\n                    TypeDef typeDef = a.ToTypeDefOrRef().ResolveTypeDef();\n\t\t\t\t\tif (typeDef == null)\n\t\t\t\t\t{\n\t\t\t\t\t\tthrow new Exception($\"type:{a} definition could not be found\");\n\t\t\t\t\t}\n\t\t\t\t\tif (typeDef.IsEnum)\n\t\t\t\t\t{\n\t\t\t\t\t\treturn ToShareTypeSig(corTypes, typeDef.GetEnumUnderlyingType());\n\t\t\t\t\t}\n                    return typeSig;\n\t\t\t\t}\n\t\t\t\tcase ElementType.Var:\n\t\t\t\tcase ElementType.MVar:\n\t\t\t\tcase ElementType.Class: return corTypes.Object;\n\t\t\t\tcase ElementType.GenericInst:\n                {\n\t\t\t\t\tvar gia = (GenericInstSig)a;\n                        TypeDef typeDef = gia.GenericType.ToTypeDefOrRef().ResolveTypeDef();\n                        if (typeDef == null)\n                        {\n                            throw new Exception($\"type:{a} definition could not be found\");\n                        }","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.hybridclr/Scripts/Editor/Share/Meta/MetaUtil.cs#L78-L114","documentation":"Thrown by MetaUtil.ToShareTypeSig when processing an ElementType.ValueType signature whose TypeDef cannot be resolved via ResolveTypeDef. The function maps CLR type signatures to sharable/canonical types for bridge generation; an unresolvable value type definition means the metadata for that type is not loaded in the current analysis context.","triggerScenarios":"ToShareTypeSig switches on the type signature's ElementType. For ValueType it calls a.ToTypeDefOrRef().ResolveTypeDef(); a null result means dnlib could not find the type definition in any loaded module, triggering the throw.","commonSituations":"The value type lives in an assembly that was not included in the analyzer's collector; the assembly was trimmed too aggressively by link.xml; a forward-referenced type from an assembly loaded later; a mismatch between the hot update and AOT assembly sets being analyzed.","solutions":["Ensure all assemblies referenced by the hot update DLLs are included in the analysis collector (check HybridCLRSettings hot update and AOT assembly lists).","Run HybridCLR/Generate/AotDlls to regenerate trimmed AOT assemblies with complete type metadata.","If a third-party assembly is involved, add it to the AOT reference resolver's search paths.","Inspect the type name printed in the exception (variable a) to identify which assembly should provide it."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Ensure the assembly defining the value type is loaded before analysis\nvar collector = new AssemblyReferenceDeepCollector(resolver, assemblyNames);\n// After collecting, verify a sample type resolves:\nif (sampleTypeSig.ToTypeDefOrRef().ResolveTypeDef() == null)\n    Debug.LogError(\"TypeDef not resolvable -- add the defining assembly to the collector.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Include all transitively-referenced assemblies in the analysis collector.","Regenerate AOT DLLs whenever dependencies change so type metadata is complete.","Avoid stripping value types that participate in cross-boundary signatures."],"tags":["hybridclr","metadata","typedef-resolution","code-generation"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}