{"record":{"id":"d6113d6a5635d6cd","repo":"stride3d/stride","slug":"unsupported-symbol-type-symboltype","errorCode":null,"errorMessage":"Unsupported symbol type: {symbolType}","messagePattern":"Unsupported symbol type: (.+?)","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Compilers/SDSL/ShaderMixer.CBuffers.cs","lineNumber":420,"sourceCode":"        {\n            return symbolType switch\n            {\n                ScalarType { Type: Scalar.Boolean } => new EffectTypeDescription { Class = EffectParameterClass.Scalar, Type = EffectParameterType.Bool, RowCount = 1, ColumnCount = 1, ElementSize = 4 },\n                ScalarType { Type: Scalar.UInt } => new EffectTypeDescription { Class = EffectParameterClass.Scalar, Type = EffectParameterType.UInt, RowCount = 1, ColumnCount = 1, ElementSize = 4 },\n                ScalarType { Type: Scalar.Int } => new EffectTypeDescription { Class = EffectParameterClass.Scalar, Type = EffectParameterType.Int, RowCount = 1, ColumnCount = 1, ElementSize = 4 },\n                ScalarType { Type: Scalar.Float } => new EffectTypeDescription { Class = EffectParameterClass.Scalar, Type = EffectParameterType.Float, RowCount = 1, ColumnCount = 1, ElementSize = 4 },\n                ScalarType { Type: Scalar.Double } => new EffectTypeDescription { Class = EffectParameterClass.Scalar, Type = EffectParameterType.Double, RowCount = 1, ColumnCount = 1, ElementSize = 8 },\n                ArrayType a => ConvertArrayType(context, a, typeModifier, alignmentRules),\n                StructType s => ConvertStructType(context, s, alignmentRules),\n                // TODO: should we use RowCount instead? (need to update Stride)\n                VectorType v => ConvertType(context, v.BaseType, typeModifier, alignmentRules) with { Class = EffectParameterClass.Vector, RowCount = 1, ColumnCount = v.Size },\n                // Note: this is HLSL-style so Rows/Columns meaning is swapped\n                //       however, for type/class, both TypeModifier and EffectParameterType are following HLSL\n                MatrixType m when typeModifier == TypeModifier.ColumnMajor || typeModifier == TypeModifier.None\n                    => ConvertType(context, m.BaseType, typeModifier, alignmentRules) with { Class = EffectParameterClass.MatrixColumns, RowCount = m.Columns, ColumnCount = m.Rows },\n                MatrixType m when typeModifier == TypeModifier.RowMajor\n                    => ConvertType(context, m.BaseType, typeModifier, alignmentRules) with { Class = EffectParameterClass.MatrixRows, RowCount = m.Columns, ColumnCount = m.Rows },\n                _ => throw new NotSupportedException($\"Unsupported symbol type: {symbolType}\"),\n            };\n        }\n\n        private void ComputeCBufferReflection(MixinGlobalContext globalContext, SpirvContext context, SpirvBuffer buffer)\n        {\n            var cbuffers = buffer\n                .Where(x => x.Op == Op.OpVariableSDSL)\n                // Note: MemberIndexOffset is simply a shift in Members index, not something like a byte offset\n                .Select(x => (\n                    Variable: x,\n                    VariableId: x.Data.IdResult!.Value,\n                    StructTypePtrId: x.Data.IdResultType!.Value,\n                    StructType: context.ReverseTypes[x.Data.IdResultType.Value] is PointerType p && p.StorageClass == Specification.StorageClass.Uniform && p.BaseType is StructuredType s ? s : null,\n                    MemberIndexOffset: 0))\n                .Where(x => x.StructType != null)\n                .ToList();\n\n            foreach (var cbuffer in cbuffers)","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Compilers/SDSL/ShaderMixer.CBuffers.cs#L402-L438","documentation":"ConvertType maps SDSL parser type symbols (base types, vectors, matrices, scalars) to effect reflection types (EffectParameterType/Class). The switch covers the known set of TypeBase-derived symbols; any other symbolType reaching it has no reflection representation and triggers this NotSupportedException. It is an exhaustiveness guard so new/unknown SDSL type symbols fail loudly instead of producing wrong reflection data.","triggerScenarios":"ConvertType is called (directly, or via ConvertStructType, element-type conversion, or ComputeCBufferReflection) with a symbolType outside the mapped set — e.g. a struct/pointer/sampler/user-defined type symbol or a newly added SDSL type kind that the converter has no case for.","commonSituations":"A newly introduced SDSL language type not yet handled in ConvertType; a type declaration reaching cbuffer reflection that should have been filtered out earlier (e.g. samplers or textures inside a cbuffer declaration); custom parser extensions producing unknown symbol types.","solutions":["Look at the symbolType value in the message to identify the unhandled type kind.","Add a matching case in the ConvertType switch to translate that symbol type into the correct EffectParameterType/Class.","If the type shouldn't appear here (e.g. textures/samplers in a cbuffer), fix the earlier parsing/collecting stage so those symbols are excluded before ComputeCBufferReflection.","Update or align your Stride version: if the type is new, ensure the reflection converter from the matching version is used."],"exampleFix":"// before\n_ => throw new NotSupportedException($\"Unsupported symbol type: {symbolType}\"),\n\n// after\nSamplerType s => new EffectParameterTypeDescription { Class = EffectParameterClass.Object, Type = EffectParameterType.Sampler },\n_ => throw new NotSupportedException($\"Unsupported symbol type: {symbolType}\"),","handlingStrategy":"validation","validationCode":"// Check the symbol type is one ConvertType handles before reflection conversion\nvar supported = symbolType is BaseType or VectorType or MatrixType or ScalarType;\nif (!supported) throw new InvalidOperationException($\"Type {symbolType} cannot be converted to effect reflection data.\");","typeGuard":"bool IsReflectableType(TypeBase t) => t is BaseType or VectorType or MatrixType or ScalarType;","tryCatchPattern":"try { var desc = ConvertType(context, symbolType, typeModifier, alignmentRules); }\ncatch (NotSupportedException ex) { log.Error($\"Reflection conversion failed: {ex.Message}. Ensure only scalars/vectors/matrices reach ConvertType.\"); throw; }","preventionTips":["Filter out non-value types (samplers, textures, structs, pointers) before cbuffer reflection conversion.","Update ConvertType's switch whenever the SDSL parser adds new type kinds.","Cover all TypeBase derived types in unit tests for ConvertType."],"tags":["shader-compilation","sdsl","reflection"],"backgroundTag":"unsupported-enum-value","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"}