{"record":{"id":"92f0dc98770203ec","repo":"stride3d/stride","slug":"could-not-resolve-type-name","errorCode":null,"errorMessage":"Could not resolve type [{Name}]","messagePattern":"Could not resolve type \\[(.+?)\\]","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/Literals.cs","lineNumber":824,"sourceCode":"                    arrayComputedSize = Convert.ToInt32(value);\n                arraySymbolType = arrayComputedSize != -1\n                    ? new ArrayType(arraySymbolType, arrayComputedSize)\n                    : new ArrayType(arraySymbolType, arrayComputedSize, sizeExpr);\n            }\n        }\n\n        return arraySymbolType;\n    }\n\n    protected SymbolType ResolveType(SymbolTable table, SpirvContext context)\n    {\n        if (!TryResolveType(table, context, out var result))\n        {\n            if (!table.ResolveExternalTypes)\n            {\n                return new ExternalType(Name, null);\n            }\n            throw new InvalidOperationException($\"Could not resolve type [{Name}]\");\n        }\n\n        return result;\n    }\n\n    // Used only indirectly\n    public override void ProcessSymbol(SymbolTable table, SymbolType? expectedType = null)\n    {\n        if (ArraySize != null)\n            foreach (var arraySize in ArraySize)\n                if (arraySize is not EmptyExpression)\n                    arraySize.ProcessSymbol(table);\n        foreach (var generic in Generics)\n            generic.ProcessSymbol(table);\n\n        Type = ResolveType(table, table.Context);\n    }\n","sourceCodeStart":806,"sourceCodeEnd":842,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/Literals.cs#L806-L842","documentation":"Thrown by ResolveType when TryResolveType fails and external type resolution is enabled (table.ResolveExternalTypes). When external resolution is disabled the resolver degrades gracefully to an ExternalType placeholder; with it enabled, an unresolvable type name is a hard error.","triggerScenarios":"Resolving a TypeName whose Name is not a declared numeric/builtin type, not defined in the SymbolTable's DeclaredTypes, and not resolvable through imported shaders, while ResolveExternalTypes is true.","commonSituations":"Using a type from an extern shader/cbuffer that was not imported; missing 'using' of the shader defining the type; typos in type names; types defined in a shader that failed to load earlier.","solutions":["Fix or correct the type name in the shader source","Import/inherit the shader that defines the custom type before using it","Check earlier compiler errors — a failed shader load often prevents its types from resolving"],"exampleFix":"// before\nMyCustomType field; // type never imported\n// after\nusing MyTypesShader;\nMyCustomType field;","handlingStrategy":"type-guard","validationCode":"if (!TryResolveType(table, context, out var result))\n    return new ExternalType(Name, null); // graceful path when external resolution is off","typeGuard":"bool TypeResolvable(string name, SymbolTable t, SpirvContext c) => TryResolveType(t, c, out _);","tryCatchPattern":"try { var t = typeName.ResolveType(table, context); }\ncatch (InvalidOperationException ex) { table.AddError(new(typeName.Info, ex.Message)); }","preventionTips":["Import shaders defining custom types before use","Set ResolveExternalTypes appropriately for your pipeline","Fix earlier load errors that block type registration"],"tags":["sdsl","type-resolution","shader-compilation"],"backgroundTag":"type-mismatch","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}