egametang/ET · error · Exception

type:{typeSig} definition could not be found. Please try `Hy

Error message

type:{typeSig} definition could not be found. Please try `HybridCLR/Genergate/LinkXml`, then Build once to generate the AOT dll, and then regenerate the bridge function

What it means

Thrown by the blittable analysis in Generator when a ValueType type signature's TypeDef cannot be resolved via ResolveTypeDef. Unlike the MetaUtil variant (191/192), this message includes an actionable remediation: generate link.xml, build once to produce the AOT DLL, then regenerate the bridge function.

Source

Thrown at Packages/cn.etetet.hybridclr/Scripts/Editor/Share/MethodBridge/Generator.cs:367

                case ElementType.U:
                case ElementType.Ptr:
                case ElementType.ByRef:
                case ElementType.FnPtr:
                case ElementType.TypedByRef: return true;
                case ElementType.String:
                case ElementType.Class:
                case ElementType.Array:
                case ElementType.SZArray:
                case ElementType.Object:
                case ElementType.Module:
                case ElementType.Var:
                case ElementType.MVar: return false;
                case ElementType.ValueType:
                {
                    TypeDef typeDef = typeSig.ToTypeDefOrRef().ResolveTypeDef();
                    if (typeDef == null)
                    {
                        throw new Exception($"type:{typeSig} definition could not be found. Please try `HybridCLR/Genergate/LinkXml`, then Build once to generate the AOT dll, and then regenerate the bridge function");
                    }
                    if (typeDef.IsEnum)
                    {
                        return true;
                    }
                    return CalculateAnalyzeTypeInfoBasic(GetSharedTypeInfo(typeSig)).blittable;
                }
                case ElementType.GenericInst:
                {
                    GenericInstSig gis = (GenericInstSig)typeSig;
                    if (!gis.GenericType.IsValueType)
                    {
                        return false;
                    }
                    TypeDef typeDef = gis.GenericType.ToTypeDefOrRef().ResolveTypeDef();
                    if (typeDef.IsEnum)
                    {
                        return true;

View on GitHub (pinned to 5cab01f7a8)

Solutions

  1. Run HybridCLR/Generate/LinkXml to regenerate link.xml with current preserve rules.
  2. Perform a Unity build once so IL2CPP produces the trimmed AOT DLLs containing the type.
  3. Run HybridCLR/Generate/AotDlls then HybridCLR/Generate/MethodBridge to regenerate bridges against complete metadata.
  4. If the type is in a third-party assembly, add an explicit preserve entry to link.xml for that assembly.

Example fix

<!-- link.xml: preserve the assembly that defines the missing value type -->
<linker>
  <assembly fullname="MyGame.Shared" preserve="all"/>
</linker>
Defensive patterns

Strategy: validation

Validate before calling

// Before blittable analysis, verify the value type assembly is preserved
var td = typeSig.ToTypeDefOrRef().ResolveTypeDef();
if (td == null)
    Debug.LogError("Cannot resolve type -- regenerate link.xml and rebuild for AOT DLLs.");

Prevention

When it happens

Trigger: During blittable computation, the ElementType.ValueType case calls typeSig.ToTypeDefOrRef().ResolveTypeDef(). A null TypeDef -- typically because the AOT assembly containing the value type was stripped away -- triggers the exception with the link.xml hint.

Common situations: IL2CPP stripping removed a value type's defining assembly because nothing in the AOT build referenced it; link.xml does not preserve the assembly or type; running MethodBridge generation before a build that materializes the AOT DLLs.

Related errors


AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13). Data as JSON: /api/errors/8f9a670dd0c380d5. Report an issue: GitHub.