{"record":{"id":"96a30cc8b2aacc09","repo":"stride3d/stride","slug":"symbol-classsource-classname-could-not-be-found","errorCode":null,"errorMessage":"Symbol [{classSource.ClassName}] could not be found.","messagePattern":"Symbol \\[(.+?)\\] could not be found\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/Literals.cs","lineNumber":647,"sourceCode":"        if (!table.ResolveExternalTypes)\n        {\n            var type = new ExternalType(name, generics);\n            return new Symbol(new(name, SymbolKind.ExternalType), type, 0);\n        }\n\n        // GenericIdentifier is same as Identifier static variable case, except we have generics (which is why GenericIdentifier was chosen over Identifier)\n        var compiledGenerics = SDFX.AST.ShaderEffect.CompileGenerics(table, context, generics);\n        var classSource = new ShaderClassInstantiation(name, compiledGenerics);\n        if (!table.TryResolveSymbol(classSource.ToClassNameWithGenerics(), out var symbol))\n        {\n            if (!table.ShaderLoader.Exists(name))\n            {\n                table.AddError(new(info, string.Format(SDSLErrorMessages.SDSL0110, name)));\n                return null;\n            }\n\n            if (!table.ShaderLoader.Exists(classSource.ClassName))\n                throw new InvalidOperationException($\"Symbol [{classSource.ClassName}] could not be found.\");\n\n            // Shader is inherited (TODO: do we want to do something more \"selective\", i.e. import only the required variable if it's a cbuffer?)\n            var inheritedShaderCount = table.InheritedShaders.Count;\n            classSource = SpirvBuilder.BuildInheritanceListIncludingSelf(table.ShaderLoader, context, classSource, table.CurrentMacros.AsSpan(), table.InheritedShaders, ResolveStep.Compile);\n            for (int i = inheritedShaderCount; i < table.InheritedShaders.Count; ++i)\n            {\n                var shaderDefinition = ShaderClass.LoadAndCacheExternalShaderDefinition(table, context, table.InheritedShaders[i]);\n                table.InheritedShaders[i].Symbol = shaderDefinition;\n                ShaderClass.Inherit(table, context, shaderDefinition, false);\n            }\n\n            // We add the typename as a symbol (similar to static access in C#)\n            var shaderId = context.GetOrImportShader(classSource.Symbol!);\n            symbol = new Symbol(new(classSource.Symbol!.Name, SymbolKind.Shader), new PointerType(new ShaderSymbol(classSource.Symbol.Name, classSource.Symbol.GenericArguments), Specification.StorageClass.Private), shaderId);\n            table.CurrentFrame.Add(classSource.ToClassNameWithGenerics(), symbol);\n        }\n\n        return symbol;","sourceCodeStart":629,"sourceCodeEnd":665,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/Literals.cs#L629-L665","documentation":"Thrown while resolving a shader class source during import: the class name referenced (e.g. a base shader in an inheritance chain) is not present in the ShaderLoader, so its definition cannot be loaded for the inheritance list. Unlike missing symbols within a shader (reported via table.AddError), this is a hard failure.","triggerScenarios":"ShaderClassInstantiation whose ClassName is not registered with table.ShaderLoader.Exists; building the inheritance list (BuildInheritanceListIncludingSelf) for a shader that imports or inherits a non-existent shader.","commonSituations":"Base shader renamed or deleted while derived shaders still reference it; shader not added to the shader compiler's search paths/plugin list; namespace-qualified name mismatch; typo in an 'using'/'inherit' clause.","solutions":["Verify the shader class name spelling and its namespace in the inherit/import clause","Ensure the shader file is in the compiler's asset/search paths so ShaderLoader can find it","Register or load the missing shader class before compiling dependents"],"exampleFix":"// before\nshader BaseShade : ComputeShader { } // typo: not found\n// after\nshader BaseShader : ComputeShader { }","handlingStrategy":"validation","validationCode":"if (!table.ShaderLoader.Exists(classSource.ClassName))\n    throw new InvalidOperationException($\"Shader {classSource.ClassName} is not available to the loader\");","typeGuard":"bool ShaderExists(ShaderClassInstantiation c, SymbolTable t) => t.ShaderLoader.Exists(c.ClassName);","tryCatchPattern":"try { SpirvBuilder.BuildInheritanceListIncludingSelf(table.ShaderLoader, context, classSource, ...); }\ncatch (InvalidOperationException ex) { log.Error($\"Missing shader class: {ex.Message}\"); throw; }","preventionTips":["Keep shader search paths up to date","Rename shaders with project-wide search for references","Verify inherit clauses compile in CI"],"tags":["sdsl","shader-loader","inheritance"],"backgroundTag":"class-not-found","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}