{"record":{"id":"ff59cb6e33ca0809","repo":"stride3d/stride","slug":"an-unknown-effectparameterclass-was-found","errorCode":null,"errorMessage":"An unknown EffectParameterClass was found.","messagePattern":"An unknown EffectParameterClass was found\\.","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Compilers/Direct3D/ShaderCompiler.cs","lineNumber":578,"sourceCode":"                        }\n                        case EffectParameterClass.Color:\n                        case EffectParameterClass.Vector:\n                        {\n                            size = elementSize * memberType.ColumnCount;\n                            break;\n                        }\n                        case EffectParameterClass.MatrixColumns:\n                        {\n                            size = elementSize * (4 * (memberType.ColumnCount - 1) + memberType.RowCount);\n                            break;\n                        }\n                        case EffectParameterClass.MatrixRows:\n                        {\n                            size = elementSize * (4 * (memberType.RowCount - 1) + memberType.ColumnCount);\n                            break;\n                        }\n                        default:\n                            throw new NotImplementedException(\"An unknown EffectParameterClass was found.\");\n                    }\n\n                    // Update element size\n                    memberType.ElementSize = size;\n\n                    // Array\n                    if (memberType.Elements > 0)\n                    {\n                        var roundedSize = (size + 15) / 16 * 16; // Round up to 16 bytes (size of float4)\n                        size += roundedSize * (memberType.Elements - 1);\n                        alignment = 16;\n                    }\n\n                    // Align to float4 if it is bigger than leftover space in current float4\n                    if (constantBufferOffset / 16 != (constantBufferOffset + size - 1) / 16)\n                        alignment = 16;\n\n                    // Align offset and store it as member offset","sourceCodeStart":560,"sourceCodeEnd":596,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Compilers/Direct3D/ShaderCompiler.cs#L560-L596","documentation":"While computing member sizes for shader reflection data, the compiler switches on EffectParameterClass (e.g. Vector, MatrixRows) to compute byte size. Encountering a parameter class not handled by the switch means the D3D reflection produced a class the compiler doesn't model, so it throws NotImplementedException.","triggerScenarios":"Compiling/reflecting a shader whose constant buffer contains a member with an EffectParameterClass outside the handled set (scalar/vector/matrix classes) — e.g. unusual structured/interface/annotation parameter classes emitted by exotic HLSL constructs or a newer d3dcompiler reflecting new classes.","commonSituations":"Shaders using interfaces, structured buffers in cbuffers, or toolchain-produced effects with novel reflection classes; upgrading the Windows SDK/D3D compiler so reflection reports classes the old Stride switch never anticipated.","solutions":["Simplify the offending cbuffer member (use plain floats/vectors/matrices) in the HLSL source.","Identify which member triggers it (the last memberType processed) and rewrite that shader construct.","Update Stride to a version whose EffectParameterClass handling covers the class reported.","If it is a new D3D reflection class from an SDK upgrade, pin the older d3dcompiler or extend the switch locally."],"exampleFix":"// before\nstruct Params { MyInterface obj; float4 color; }; // interface member in cbuffer\n// after\nstruct Params { float4 color; }; // only scalar/vector/matrix members","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { var bc = ShaderCompiler.Compile(src, ep, stage, profile); }\ncatch (NotImplementedException ex) when (ex.Message.Contains(\"EffectParameterClass\")) { /* simplify the offending cbuffer member or update Stride */ }","preventionTips":["Keep cbuffers to scalar/vector/matrix members","Avoid interfaces and exotic constructs in constant buffers","Keep Stride and the D3D compiler SDK versions aligned"],"tags":["shader","reflection","notimplemented","direct3d"],"backgroundTag":"method-not-implemented","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"}