{"record":{"id":"234b9aeeabfc435c","repo":"stride3d/stride","slug":"this-could-not-resolve-symbol","errorCode":null,"errorMessage":"{this} could not resolve symbol","messagePattern":"(.+?) could not resolve symbol","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/Literals.cs","lineNumber":440,"sourceCode":"            base.SetValue(table, compiler, rvalue);\n            return;\n        }\n\n        rvalue = builder.Convert(context, rvalue, ((PointerType)Type).BaseType);\n        builder.Insert(new OpStore(target.Id, rvalue.Id, null, []));\n    }\n\n    public override SpirvValue CompileImpl(SymbolTable table, CompilerUnit compiler)\n    {\n        var (builder, context) = compiler;\n\n        return CompileSymbol(table, builder, context, builder.CurrentFunction == null);\n    }\n\n    protected virtual SpirvValue CompileSymbol(SymbolTable table, SpirvBuilder builder, SpirvContext context, bool constantOnly)\n    {\n        if (ResolvedSymbol is null)\n            throw new InvalidOperationException($\"{this} could not resolve symbol\");\n\n        var symbol = ShaderDefinition.ImportSymbol(table, context, ResolvedSymbol);\n\n        // Track when a stage method accesses a non-stage variable (without composition qualifier).\n        // This forces the shader to be fully imported at root level instead of stage-only during mixin.\n        if (symbol.MemberAccessWithImplicitThis != null && !symbol.Id.IsStage && builder.CurrentFunction is { IsStage: true })\n        {\n            var varOwner = symbol.OwnerType;\n            if (varOwner != null && varOwner != table.CurrentShader)\n            {\n                foreach (var inst in context)\n                {\n                    if (inst.Op == Spirv.Specification.Op.OpMixinInheritSDSL && (OpMixinInheritSDSL)inst is { } inherit\n                        && table.ResolveShader(inherit.Shader) is { } lss && lss.Name == varOwner.Name)\n                    {\n                        inherit.Flags |= Spirv.Specification.MixinInheritFlagsMask.NeedsFullImport;\n                        break;\n                    }","sourceCodeStart":422,"sourceCodeEnd":458,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/Literals.cs#L422-L458","documentation":"Thrown by CompileSymbol when the AST node's ResolvedSymbol property is null, i.e. symbol resolution (name binding) failed but the node still reached SPIR-V emission. The compiler cannot emit code for an identifier it could not bind to a declared symbol.","triggerScenarios":"Compiling a ShaderLiteral/identifier node whose name did not match any declaration in the SymbolTable, so the earlier resolution pass left ResolvedSymbol null; calling CompileSymbol directly without running resolution.","commonSituations":"Typos in variable/function names in SDSL code; referencing symbols from a mixin/inherit chain that was not fully imported; using a variable before its declaration; SDSL0110-style lookup failures silently ignored upstream.","solutions":["Fix the shader source so the identifier refers to a declared, in-scope symbol","Ensure symbol resolution runs (and reports errors) before SPIR-V compilation","Check inheritance/mixin setup so referenced stage variables are actually imported"],"exampleFix":"// before\nfloat c = undeclaredVar; // ResolvedSymbol stays null\n// after\nfloat declaredVar = 1.0;\nfloat c = declaredVar;","handlingStrategy":"validation","validationCode":"if (node.ResolvedSymbol is null)\n    table.AddError(new(node.Info, SDSLErrorMessages.SDSL0110)); // report instead of emitting","typeGuard":"bool IsResolved(ShaderLiteral node) => node.ResolvedSymbol is not null;","tryCatchPattern":"try { node.CompileSymbol(table, builder, context, constantOnly); }\ncatch (InvalidOperationException ex) { table.AddError(new(node.Info, ex.Message)); }","preventionTips":["Run full symbol resolution before SPIR-V generation","Report unresolved identifiers as compile errors at resolution time","Check shader inheritance imports cover all referenced names"],"tags":["sdsl","symbol-resolution","shader-compilation"],"backgroundTag":"entity-not-found","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"}