{"record":{"id":"e9aa99f929dc7612","repo":"stride3d/stride","slug":"typeof-t-type-is-not-supported","errorCode":null,"errorMessage":"{ typeof(T[]) } type is not supported.","messagePattern":"(.+?) type is not supported\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Assets/Physics/HeightmapAssetCompiler.cs","lineNumber":315,"sourceCode":"                if (typeOfT == typeof(float))\n                {\n                    min = heightRange.X;\n                    max = heightRange.Y;\n                }\n                else if (typeOfT == typeof(short) || typeOfT == typeof(byte))\n                {\n                    CalculateByteOrShortRange(heightRange, heightScale, out min, out max);\n\n                    if (!MathUtil.IsInRange(min, minT, maxT) ||\n                        !MathUtil.IsInRange(max, minT, maxT))\n                    {\n                        throw new Exception(\n                            $\"{ nameof(ScaleToHeightRange) } failed to scale { minT }..{ maxT } to { min }..{ max }. Check HeightScale and HeightRange are proper.\");\n                    }\n                }\n                else\n                {\n                    throw new NotSupportedException($\"{ typeof(T[]) } type is not supported.\");\n                }\n\n                commandContext?.Logger.Info($\"[{Url}] ScaleToHeightRange : { minT }..{ maxT } -> { min }..{ max }\");\n\n                if (typeOfT == typeof(float))\n                {\n                    float[] floats = heights as float[];\n                    for (var i = 0; i < floats.Length; ++i)\n                    {\n                        floats[i] = MathUtil.Clamp(MathUtil.Lerp(min, max, MathUtil.InverseLerp(minT, maxT, floats[i])), min, max);\n                    }\n                }\n                else if (typeOfT == typeof(short))\n                {\n                    short[] shorts = heights as short[];\n                    for (var i = 0; i < shorts.Length; ++i)\n                    {\n                        shorts[i] = (short)MathUtil.Clamp(MathUtil.Lerp(min, max, MathUtil.InverseLerp(minT, maxT, shorts[i])), min, max);","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Assets/Physics/HeightmapAssetCompiler.cs#L297-L333","documentation":"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.","triggerScenarios":"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.","commonSituations":"Custom or modified heightmap compilation code passing float arrays, or an asset whose HeightType resolves to an unexpected type before scaling.","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)"],"exampleFix":"// before\nScaleToHeightRange<float>(floatData, ...); // unsupported T\n// after\nScaleToHeightRange<short>(shortData, ...); // supported height type","handlingStrategy":"validation","validationCode":"if (heightType != HeightType.Byte && heightType != HeightType.Short)\n    throw new InvalidOperationException($\"HeightType {heightType} cannot be scaled; expected Byte or Short\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["physics","heightmap","unsupported-type"],"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"}