stride3d/stride · error · NotSupportedException

Unsupported this-type

Error message

Unsupported this-type {thisType} for parameter info

What it means

While building parameter info (element type + size) for an intrinsic parameter matched against thisType (index -1), the expander only knows how to describe textures, constant/typed buffers, and structured buffers. Any other thisType is rejected with this NotSupportedException.

Solutions

  1. Ensure the call site passes a supported resource type (Texture, Buffer, StructuredBuffer, Append/ConsumeStructuredBuffer)
  2. Restrict the intrinsic declaration so only resource types can match
  3. Add a case in the switch if a new resource kind must be supported

Example fix

// before
float4 c = myVector.Load(i);
// after
float4 c = myTexture.Load(int2(i, 0));
Defensive patterns

Strategy: validation

Validate before calling

if (paramMatchIndex == -1 && thisType is not (TextureType or BufferType or StructuredBufferType or AppendStructuredBufferType or ConsumeStructuredBufferType))
    throw new NotSupportedException($"{thisType} unsupported for thisType-parameterized intrinsic");

Type guard

bool SupportsThisTypeMatch(TypeBase t) => t is TextureType or BufferType or StructuredBufferType or AppendStructuredBufferType or ConsumeStructuredBufferType;

Try / catch

try { Expand(intrinsic, thisType); }
catch (NotSupportedException ex) when (ex.Message.Contains("Unsupported this-type")) { /* surface the unsupported call site */ }

Prevention

When it happens

Trigger: An intrinsic parameter using match(thisType) invoked on a type outside the supported set: scalars, vectors, matrices, custom structs, or ByteAddressBuffer (handled only for index -3).

Common situations: Applying resource-parameterized intrinsics (e.g. Load/Sample helpers) to non-resource types; SDSL generic intrinsics bound to unexpected argument types at a call site.

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/38adc8e02547e080. Report an issue: GitHub.

Appendix: source

Thrown at sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/AST/IntrinsicTemplateExpander.cs:291

                                        parameterTypeHelper[location.SourceArgument].Size2 = new(sizePermutation.Size, sizePermutation.Generator);
                                        break;
                                }
                            }
                        }

                        ParameterTypeInfo GetParameterInfo(int index)
                        {
                            if (index == -1)
                            {
                                return thisType switch
                                {
                                    null => throw new ArgumentNullException(nameof(thisType)),
                                    TextureType t => new(t.ReturnType.GetElementType(), new(t.ReturnType.GetElementCount(), null), default),
                                    BufferType b => new(b.BaseType.GetElementType(), new(b.BaseType.GetElementCount(), null), default),
                                    AppendStructuredBufferType b => new(b.BaseType, new(1, null), default),
                                    ConsumeStructuredBufferType b => new(b.BaseType, new(1, null), default),
                                    StructuredBufferType b => new(b.BaseType, new(1, null), default),
                                    _ => throw new NotSupportedException($"Unsupported this-type {thisType} for parameter info"),
                                };
                            }
                            if (index == -3)
                            {
                                return thisType switch
                                {
                                    null => throw new ArgumentNullException(nameof(thisType)),
                                    ByteAddressBufferType => new(ScalarType.UInt, new(1, null), default),
                                    _ => throw new NotImplementedException($"$funcT not supported for {thisType}"),
                                };
                            }
                            return parameterTypeHelper[index];
                        }

                        // Use match() to fill size info
                        for (var index = 0; index < intrinsicDefinition.Parameters.Length + 1; index++)
                        {
                            var parameterType = index > 0 ? intrinsicDefinition.Parameters[index - 1].Type : intrinsicDefinition.Return;

View on GitHub (pinned to 96fad776d2)