egametang/ET · error · Exception
type:{a} definition could not be found
Error message
type:{a} definition could not be found What it means
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.
Source
Thrown at Packages/cn.etetet.hybridclr/Scripts/Editor/Share/Meta/MetaUtil.cs:96
case ElementType.U8: return corTypes.UInt64;
case ElementType.R4: return corTypes.Single;
case ElementType.R8: return corTypes.Double;
case ElementType.String: return corTypes.Object;
case ElementType.TypedByRef: return corTypes.TypedReference;
case ElementType.I: return corTypes.IntPtr;
case ElementType.U: return corTypes.UIntPtr;
case ElementType.Object: return corTypes.Object;
case ElementType.Sentinel: return typeSig;
case ElementType.Ptr: return corTypes.UIntPtr;
case ElementType.ByRef: return corTypes.UIntPtr;
case ElementType.SZArray: return corTypes.Object;
case ElementType.Array: return corTypes.Object;
case ElementType.ValueType:
{
TypeDef typeDef = a.ToTypeDefOrRef().ResolveTypeDef();
if (typeDef == null)
{
throw new Exception($"type:{a} definition could not be found");
}
if (typeDef.IsEnum)
{
return ToShareTypeSig(corTypes, typeDef.GetEnumUnderlyingType());
}
return typeSig;
}
case ElementType.Var:
case ElementType.MVar:
case ElementType.Class: return corTypes.Object;
case ElementType.GenericInst:
{
var gia = (GenericInstSig)a;
TypeDef typeDef = gia.GenericType.ToTypeDefOrRef().ResolveTypeDef();
if (typeDef == null)
{
throw new Exception($"type:{a} definition could not be found");
}View on GitHub (pinned to 5cab01f7a8)
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.
Defensive patterns
Strategy: validation
Validate before calling
// Ensure the assembly defining the value type is loaded before analysis
var collector = new AssemblyReferenceDeepCollector(resolver, assemblyNames);
// After collecting, verify a sample type resolves:
if (sampleTypeSig.ToTypeDefOrRef().ResolveTypeDef() == null)
Debug.LogError("TypeDef not resolvable -- add the defining assembly to the collector."); Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- type:{type} definition could not be found. Please try `Hybri
- no aot assembly found. please run `HybridCLR/Generate/All` o
- no aot assembly found. please run `HybridCLR/Generate/All` o
- ERR_LocationPrimaryUnavailable
- can't find xxxx.xcodeproj/project.pbxproj in {pathToBuiltPro
AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13).
Data as JSON: /api/errors/5929af3f303b88c4.
Report an issue: GitHub.