stride3d/stride · error · NotSupportedException
type is not supported.
Error message
{ typeof(T[]) } type is not supported. What it means
ScaleToHeightRange<T> is a generic helper that only implements scaling for supported array element types (Byte and Short height data). If called with any other T (e.g. float[] unexpectedly routed through the quantizing path), it throws NotSupportedException naming typeof(T[]). This is a defensive guard against an internal misconfiguration, not user data corruption per se.
Solutions
- Ensure HeightType is set to Byte or Short so the correct array type path is used
- Fix custom compilation code to call ScaleToHeightRange only with byte[]/short[]
- Convert the data to a supported type before invoking the helper
- Upgrade Stride if this occurs with stock assets (possible engine bug)
Example fix
// before ScaleToHeightRange<float>(floatData, ...); // unsupported T // after ScaleToHeightRange<short>(shortData, ...); // supported height type
Defensive patterns
Strategy: validation
Validate before calling
if (heightType != HeightType.Byte && heightType != HeightType.Short)
throw new InvalidOperationException($"HeightType {heightType} cannot be scaled; expected Byte or Short"); Prevention
- Only route byte[]/short[] data through ScaleToHeightRange
- Keep HeightType aligned with the actual data array type
- Don't modify compiler internals without handling all generic cases
- Report stock-asset occurrences upstream as engine bugs
When it happens
Trigger: DoCommandOverride invokes ScaleToHeightRange with a generic T other than the supported height types (Byte/Short), usually because HeightType was misinterpreted or a code path passes float[] into the quantizing helper.
Common situations: Custom or modified heightmap compilation code passing float arrays, or an asset whose HeightType resolves to an unexpected type before scaling.
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
- format is not supported.
- . should be greater than .
- height type is not supported.
- Failed to compile .
- failed to scale .. to .. . Check HeightScale and…
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/e9aa99f929dc7612.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Assets/Physics/HeightmapAssetCompiler.cs:315
if (typeOfT == typeof(float))
{
min = heightRange.X;
max = heightRange.Y;
}
else if (typeOfT == typeof(short) || typeOfT == typeof(byte))
{
CalculateByteOrShortRange(heightRange, heightScale, out min, out max);
if (!MathUtil.IsInRange(min, minT, maxT) ||
!MathUtil.IsInRange(max, minT, maxT))
{
throw new Exception(
$"{ nameof(ScaleToHeightRange) } failed to scale { minT }..{ maxT } to { min }..{ max }. Check HeightScale and HeightRange are proper.");
}
}
else
{
throw new NotSupportedException($"{ typeof(T[]) } type is not supported.");
}
commandContext?.Logger.Info($"[{Url}] ScaleToHeightRange : { minT }..{ maxT } -> { min }..{ max }");
if (typeOfT == typeof(float))
{
float[] floats = heights as float[];
for (var i = 0; i < floats.Length; ++i)
{
floats[i] = MathUtil.Clamp(MathUtil.Lerp(min, max, MathUtil.InverseLerp(minT, maxT, floats[i])), min, max);
}
}
else if (typeOfT == typeof(short))
{
short[] shorts = heights as short[];
for (var i = 0; i < shorts.Length; ++i)
{
shorts[i] = (short)MathUtil.Clamp(MathUtil.Lerp(min, max, MathUtil.InverseLerp(minT, maxT, shorts[i])), min, max);View on GitHub (pinned to 96fad776d2)