{"record":{"id":"c4bcd780e7221a7c","repo":"stride3d/stride","slug":"unknown-optional-qualifier-str","errorCode":null,"errorMessage":"Unknown optional qualifier: {str}","messagePattern":"Unknown optional qualifier: (.+?)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Parsers/Core/IntrinsicsParameters.cs","lineNumber":106,"sourceCode":"    { }\n}\n\n\npublic static partial class IntrinsicsDefinitions\n{\n    static Qualifier FromString(string str) => str switch\n    {\n        \"in\" => Qualifier.In,\n        \"out\" => Qualifier.Out,\n        \"inout\" => Qualifier.InOut,\n        \"ref\" => Qualifier.Ref,\n        _ => throw new ArgumentException($\"Unknown qualifier: {str}\"),\n    };\n    static OptionalQualifier FromStringOptional(string str) => str switch\n    {\n        \"row_major\" => OptionalQualifier.RowMajor,\n        \"col_major\" => OptionalQualifier.ColumnMajor,\n        _ => throw new ArgumentException($\"Unknown optional qualifier: {str}\"),\n    };\n}\n\npublic enum BaseType\n{\n    Bool,\n    Int,\n    Int32Only,\n    Int16,\n    Int64,\n    SInt16Or32,\n    AnyInt,\n    AnyInt16Or32,\n    AnyInt32,\n    AnyInt64,\n    Int64Only,\n    Uint,\n    Uint16,","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Parsers/Core/IntrinsicsParameters.cs#L88-L124","documentation":"IntrinsicsDefinitions.FromStringOptional parses optional matrix-layout qualifiers into the OptionalQualifier enum. Only 'row_major' and 'col_major' are accepted; anything else throws ArgumentException('Unknown optional qualifier: ...').","triggerScenarios":"Calling FromStringOptional (directly or while deserializing intrinsic parameter tables) with any string other than 'row_major'/'col_major' — e.g. 'column_major' (HLSL spelling vs the parser's 'col_major'), empty string when the column is absent, or 'packoffset' mistakenly routed to the qualifier field.","commonSituations":"Porting HLSL intrinsic signatures verbatim ('column_major' instead of 'col_major'); blank table cells being passed as empty strings; typos like 'row-major'; adding a new layout qualifier to the enum without extending the switch.","solutions":["Normalize the input to exactly 'row_major' or 'col_major' (Trim/lowercase, and translate HLSL 'column_major' to 'col_major').","If the qualifier is genuinely optional and absent, pass null instead of an empty string (the Parameter.OptionalQualifier field is nullable).","If a new optional qualifier is needed, add an arm to the FromStringOptional switch in IntrinsicsParameters.cs."],"exampleFix":"// before\nvar oq = IntrinsicsDefinitions.FromStringOptional(\"column_major\"); // ArgumentException\n\n// after\nvar normalized = token == \"column_major\" ? \"col_major\" : token.Trim();\nvar oq = string.IsNullOrEmpty(normalized) ? null : IntrinsicsDefinitions.FromStringOptional(normalized);","handlingStrategy":"validation","validationCode":"var t = token?.Trim();\nif (t == \"column_major\") t = \"col_major\"; // normalize HLSL spelling\nif (t is not (\"row_major\" or \"col_major\"))\n    return null; // or throw: not a valid optional qualifier","typeGuard":"bool IsValidOptionalQualifier(string? s) => s is \"row_major\" or \"col_major\";","tryCatchPattern":"try { optQualifier = IntrinsicsDefinitions.FromStringOptional(token); }\ncatch (ArgumentException ex) when (ex.Message.StartsWith(\"Unknown optional qualifier:\"))\n{\n    optQualifier = null; // qualifier is optional; treat unknown/empty as absent and log\n    logger.LogWarning(\"Ignoring unrecognized optional qualifier '{Token}'\", token);\n}","preventionTips":["Use the parser's spelling 'col_major', not HLSL's 'column_major'.","Treat empty table cells as null (the field is nullable) rather than passing \"\" to FromStringOptional.","Normalize tokens (Trim + map synonyms) before calling the parser."],"tags":["argument","enum-mapping","intrinsics","parsing"],"backgroundTag":"invalid-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"}