{"record":{"id":"0fb61185ca267161","repo":"stride3d/stride","slug":"unknown-base-type-basetype","errorCode":null,"errorMessage":"Unknown base type: {baseType}","messagePattern":"Unknown base type: (.+?)","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Parsers/Core/IntrinsicsParameters.cs","lineNumber":73,"sourceCode":"                \"RWByteAddressBuffer\" => BaseType.RWByteAddressBuffer,\n                \"VkBufferPointer\" => BaseType.VkBufferPointer,\n                \"Texture2D\" => BaseType.Texture2D,\n                \"Texture2DArray\" => BaseType.Texture2DArray,\n                \"acceleration_struct\"\n                or \"ray_desc\"\n                or \"udt\"\n                or \"triangle_positions\"\n                or \"p32i8\"\n                or \"p32u8\"\n                or \"resource\"\n                or \"NodeRecordOrUAV\"\n                or \"LinAlg\"\n                or \"DxHitObject\"\n                or \"RayQuery\"\n                or \"ThreadNodeOutputRecords\"\n                or \"GroupNodeOutputRecords\"\n                    => BaseType.Other,\n                _ => throw new ArgumentException($\"Unknown base type: {baseType}\"),\n            },\n            VectorSize,\n            matching\n        )\n\n    { }\n}\n\npublic record struct Parameter(Qualifier? Qualifier, OptionalQualifier? OptionalQualifier, ParameterType Type, string Name);\n\npublic record class IntrinsicDefinition(ParameterType Return, Parameter[] Parameters)\n{\n    public IntrinsicDefinition(ParameterType @return, params ReadOnlySpan<Parameter> parameters)\n        : this(@return, parameters.ToArray())\n    { }\n}\n\n","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Parsers/Core/IntrinsicsParameters.cs#L55-L91","documentation":"The ParameterType(string baseType, ...) convenience constructor maps intrinsic-declaration type strings (bool, int, sampler2d, Texture2D, ...) to the BaseType enum via an exhaustive switch. Any string not in the whitelist — including typos, casing differences, and types added to the enum but not to the switch — throws ArgumentException('Unknown base type: ...'). It is a fail-fast guard over the intrinsic-definition tables.","triggerScenarios":"Constructing ParameterType with a string base type not present in the switch in IntrinsicsParameters.cs:16-73, e.g. new ParameterType(\"Texture3D\") or new ParameterType(\"Float\"). Also triggered internally when displayTestResults or intrinsic-table entries (_Wrapper) pass an unrecognized type name, and when a BaseType variant is added without a corresponding string mapping (e.g. Texture2DArray has no string arm).","commonSituations":"Hand-editing or extending the intrinsics definition tables with a new type name; casing/typo mistakes ('texture2D' vs 'Texture2D'); adding a BaseType enum member (like Texture2DArray) without extending the string switch; porting HLSL type names verbatim instead of the parser's lowercase identifiers.","solutions":["Check the exact accepted strings in the switch at IntrinsicsParameters.cs:16-73 and use one of them verbatim (case-sensitive: 'sampler2d', 'Texture2D', 'any_float', ...).","If your type maps to the generic BaseType.Other, use one of the recognized alias strings (e.g. 'udt', 'resource') or extend the switch with your string.","If you added a new BaseType member, add a corresponding string arm to the switch (e.g. \"Texture2DArray\" => BaseType.Texture2DArray).","For flexible cases, construct the record directly with a BaseType value (new ParameterType(BaseType.Texture2DArray)) instead of the string overload."],"exampleFix":"// before\nvar t = new ParameterType(\"Texture3D\"); // ArgumentException\n\n// after\nvar t = new ParameterType(BaseType.Texture2D); // or add \"Texture3D\" => ... to the switch","handlingStrategy":"validation","validationCode":"static readonly HashSet<string> ValidBaseTypes = new(StringComparer.Ordinal)\n{ \"bool\",\"int\",\"int16_t\",\"int32_only\",\"int64_t\",\"int64_only\",\"sint16or32_only\",\"any_int\",\"any_int32\",\"any_int64\",\"any_int16or32\",\"uint\",\"uint16_t\",\"u64\",\"float\",\"float16\",\"half\",\"float16_t\",\"any_float\",\"double\",\"double_only\",\"sampler1d\",\"sampler2d\",\"sampler3d\",\"sampler_cube\",\"sampler_cmp\",\"sampler\",\"any_sampler\",\"wave\",\"void\",\"uint_only\",\"numeric\",\"numeric16_only\",\"numeric32_only\",\"float32_only\",\"any\",\"float_like\",\"match\",\"ByteAddressBuffer\",\"RWByteAddressBuffer\",\"VkBufferPointer\",\"Texture2D\",\"Texture2DArray\",\"acceleration_struct\",\"ray_desc\",\"udt\",\"triangle_positions\",\"p32i8\",\"p32u8\",\"resource\",\"NodeRecordOrUAV\",\"LinAlg\",\"DxHitObject\",\"RayQuery\",\"ThreadNodeOutputRecords\",\"GroupNodeOutputRecords\" };\nif (!ValidBaseTypes.Contains(baseType))\n    throw new ArgumentException($\"{baseType} is not a whitelisted intrinsic base type\");","typeGuard":"bool IsValidBaseTypeString(string s) =>\n    s is \"bool\" or \"int\" or \"uint\" or \"float\" or \"double\" or \"half\" or\n         \"Texture2D\" or \"Texture2DArray\" or \"sampler2d\" or \"void\" or \"any\"; // check against the full switch list","tryCatchPattern":"try { var t = new ParameterType(baseTypeString); }\ncatch (ArgumentException ex) when (ex.Message.StartsWith(\"Unknown base type:\"))\n{\n    logger.LogError(\"Intrinsic table entry has unrecognized base type: {0}\", ex.Message);\n    throw; // or fix/skip the offending table entry\n}","preventionTips":["Copy type strings from existing intrinsic table entries rather than typing them by hand.","Remember the mapping is case-sensitive: 'sampler2d' (lowercase) but 'Texture2D' (PascalCase).","When adding a BaseType enum member, always extend the string switch in the same change.","Validate intrinsics definition files at build/startup time so bad names fail fast."],"tags":["argument","enum-mapping","intrinsics","shader-parsing"],"backgroundTag":"invalid-argument-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"}