{"record":{"id":"89f59778e3e5ad7b","repo":"stride3d/stride","slug":"parameterkey-type-0-is-not-supported-by-setstream","errorCode":null,"errorMessage":"ParameterKey type [{0}] is not supported by SetStream","messagePattern":"ParameterKey type \\[(.+?)\\] is not supported by SetStream","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Rendering/Rendering/Materials/MaterialBlendLayerContext.cs","lineNumber":98,"sourceCode":"            if (defaultValueKey.PropertyType == typeof(Vector4) || defaultValueKey.PropertyType == typeof(Color4))\n            {\n                streamType = MaterialStreamType.Float4;\n            }\n            else if (defaultValueKey.PropertyType == typeof(Vector3) || defaultValueKey.PropertyType == typeof(Color3))\n            {\n                streamType = MaterialStreamType.Float3;\n            }\n            else if (defaultValueKey.PropertyType == typeof(Vector2) || defaultValueKey.PropertyType == typeof(Half2))\n            {\n                streamType = MaterialStreamType.Float2;\n            }\n            else if (defaultValueKey.PropertyType == typeof(float))\n            {\n                streamType = MaterialStreamType.Float;\n            }\n            else\n            {\n                throw new NotSupportedException(\"ParameterKey type [{0}] is not supported by SetStream\".ToFormat(defaultValueKey.PropertyType));\n            }\n\n            var classSource = computeNode.GenerateShaderSource(Context, new MaterialComputeColorKeys(defaultTexturingKey, defaultValueKey, defaultTextureValue));\n            SetStream(stage, stream, streamType, classSource);\n        }\n\n        public void SetStream(MaterialShaderStage stage, string stream, MaterialStreamType streamType, ShaderSource classSource)\n        {\n            if (stream == null) throw new ArgumentNullException(nameof(stream));\n\n            // Blend stream is not part of the stream used\n            if (stream != MaterialBlendLayer.BlendStream)\n            {\n                GetContextPerStage(stage).Streams.Add(stream);\n            }\n\n            string channel;\n            switch (streamType)","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Rendering/Rendering/Materials/MaterialBlendLayerContext.cs#L80-L116","documentation":"MaterialBlendLayerContext.SetStream maps a ParameterKey's property type to a MaterialStreamType when generating the shader for a stream. If the key's type is not one of the supported types (e.g. not Vector4/Vector3/Vector2/float), it throws NotSupportedException naming the unsupported type.","triggerScenarios":"Calling SetStream (or SetStreamBlend) with a ParameterKey whose PropertyType is not a supported vector/float type — e.g. a Color4, bool, int, or custom struct key used as a stream default value key.","commonSituations":"Using a ParameterKey of an unusual type as the surface's default value; typos passing a wrong key to SetStream; custom shader streams with non-standard value types.","solutions":["Use a ParameterKey whose PropertyType is one of the supported types (Vector4, Vector3, Vector2, or float)","Convert the value: e.g. replace a bool key with a float key, or wrap the value into a Vector4","Add a case for the desired type in MaterialBlendLayerContext.SetStream if you control the code","Check the message's [{0}] value to see the exact unsupported PropertyType"],"exampleFix":"// before: unsupported bool parameter key\ncontext.SetStream(surfaceStage, \"CustomStream\", MaterialKeys.BoolKey, texturingKey, computeNode);\n// after: use a float key instead\ncontext.SetStream(surfaceStage, \"CustomStream\", MaterialKeys.FloatKey, texturingKey, computeNode);","handlingStrategy":"validation","validationCode":"Type t = defaultValueKey.PropertyType;\nbool ok = t == typeof(Vector4) || t == typeof(Vector3) || t == typeof(Vector2) || t == typeof(float);\nif (!ok) throw new InvalidOperationException($\"Key {defaultValueKey} type {t} not supported by SetStream\");","typeGuard":"bool IsStreamCompatibleKey(ParameterKey k) =>\n    k.PropertyType == typeof(Vector4) || k.PropertyType == typeof(Vector3) ||\n    k.PropertyType == typeof(Vector2) || k.PropertyType == typeof(float);","tryCatchPattern":null,"preventionTips":["Choose ParameterKeys with float/vector PropertyTypes for streams","Convert other value types (bool/int) to float keys","Check key types in unit tests covering custom blend layers"],"tags":["material","streams","unsupported-type","shader"],"backgroundTag":"unsupported-operation","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"}