stride3d/stride · error · NotSupportedException

ParameterKey type [ ] is not supported by SetStream

Error message

ParameterKey type [{0}] is not supported by SetStream

What it means

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.

Solutions

  1. Use a ParameterKey whose PropertyType is one of the supported types (Vector4, Vector3, Vector2, or float)
  2. Convert the value: e.g. replace a bool key with a float key, or wrap the value into a Vector4
  3. Add a case for the desired type in MaterialBlendLayerContext.SetStream if you control the code
  4. Check the message's [{0}] value to see the exact unsupported PropertyType

Example fix

// before: unsupported bool parameter key
context.SetStream(surfaceStage, "CustomStream", MaterialKeys.BoolKey, texturingKey, computeNode);
// after: use a float key instead
context.SetStream(surfaceStage, "CustomStream", MaterialKeys.FloatKey, texturingKey, computeNode);
Defensive patterns

Strategy: validation

Validate before calling

Type t = defaultValueKey.PropertyType;
bool ok = t == typeof(Vector4) || t == typeof(Vector3) || t == typeof(Vector2) || t == typeof(float);
if (!ok) throw new InvalidOperationException($"Key {defaultValueKey} type {t} not supported by SetStream");

Type guard

bool IsStreamCompatibleKey(ParameterKey k) =>
    k.PropertyType == typeof(Vector4) || k.PropertyType == typeof(Vector3) ||
    k.PropertyType == typeof(Vector2) || k.PropertyType == typeof(float);

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/89f59778e3e5ad7b. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Rendering/Rendering/Materials/MaterialBlendLayerContext.cs:98

            if (defaultValueKey.PropertyType == typeof(Vector4) || defaultValueKey.PropertyType == typeof(Color4))
            {
                streamType = MaterialStreamType.Float4;
            }
            else if (defaultValueKey.PropertyType == typeof(Vector3) || defaultValueKey.PropertyType == typeof(Color3))
            {
                streamType = MaterialStreamType.Float3;
            }
            else if (defaultValueKey.PropertyType == typeof(Vector2) || defaultValueKey.PropertyType == typeof(Half2))
            {
                streamType = MaterialStreamType.Float2;
            }
            else if (defaultValueKey.PropertyType == typeof(float))
            {
                streamType = MaterialStreamType.Float;
            }
            else
            {
                throw new NotSupportedException("ParameterKey type [{0}] is not supported by SetStream".ToFormat(defaultValueKey.PropertyType));
            }

            var classSource = computeNode.GenerateShaderSource(Context, new MaterialComputeColorKeys(defaultTexturingKey, defaultValueKey, defaultTextureValue));
            SetStream(stage, stream, streamType, classSource);
        }

        public void SetStream(MaterialShaderStage stage, string stream, MaterialStreamType streamType, ShaderSource classSource)
        {
            if (stream == null) throw new ArgumentNullException(nameof(stream));

            // Blend stream is not part of the stream used
            if (stream != MaterialBlendLayer.BlendStream)
            {
                GetContextPerStage(stage).Streams.Add(stream);
            }

            string channel;
            switch (streamType)

View on GitHub (pinned to 96fad776d2)