{"record":{"id":"d709ec49c9871ed5","repo":"stride3d/stride","slug":"nameof-parameters-floatingpointcomponentrange-nameof","errorCode":null,"errorMessage":"{ nameof(Parameters.FloatingPointComponentRange) }.{ nameof(Parameters.FloatingPointComponentRange.Y) } should be greater than { nameof(Parameters.FloatingPointComponentRange.X) }.","messagePattern":"(.+?)\\.(.+?) should be greater than (.+?)\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Assets/Physics/HeightmapAssetCompiler.cs","lineNumber":143,"sourceCode":"\n                        default:\n                            throw new Exception($\"{ texImage.Format } format is not supported.\");\n                    }\n\n                    // Convert pixels to heights\n\n                    using (var image = textureTool.ConvertToStrideImage(texImage))\n                    {\n                        var pixelBuffer = image.PixelBuffer[0];\n                        var pixelBufferSize = new Int2(pixelBuffer.Width, pixelBuffer.Height);\n\n                        var minFloat = Parameters.FloatingPointComponentRange.X;\n                        var maxFloat = Parameters.FloatingPointComponentRange.Y;\n                        var isSNorm = (Math.Abs(-1 - minFloat) < float.Epsilon) && (Math.Abs(1 - maxFloat) < float.Epsilon);\n\n                        if (maxFloat < minFloat)\n                        {\n                            throw new Exception($\"{ nameof(Parameters.FloatingPointComponentRange) }.{ nameof(Parameters.FloatingPointComponentRange.Y) } should be greater than { nameof(Parameters.FloatingPointComponentRange.X) }.\");\n                        }\n\n                        var useScaleToRange = Parameters.ScaleToHeightRange;\n\n                        switch (heightType)\n                        {\n                            case HeightfieldTypes.Float:\n                                {\n                                    float[] floats = null;\n\n                                    switch (image.Description.Format)\n                                    {\n                                        case PixelFormat.R32_Float:\n                                            floats = HeightmapUtils.Resize(pixelBuffer.GetPixels<float>(), pixelBufferSize, size);\n                                            floats = isSNorm ?\n                                                floats :\n                                                HeightmapUtils.ConvertToFloatHeights(floats, minFloat, maxFloat);\n                                            break;","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Assets/Physics/HeightmapAssetCompiler.cs#L125-L161","documentation":"FloatingPointComponentRange defines the min (X) and max (Y) float values used to map heightmap pixel data to heights. The compiler validates that Y (max) is not less than X (min) before scaling and throws this descriptive exception when the range is inverted.","triggerScenarios":"Setting Parameters.FloatingPointComponentRange with X > Y on a heightmap asset that uses ScaleToHeightRange or floating-point height data, compiled in DoCommandOverride.","commonSituations":"Typo when hand-editing the .sdfloat asset properties, copy-pasting a range backwards, or programmatically configuring the asset with swapped min/max.","solutions":["Swap the values so FloatingPointComponentRange.X is the minimum and Y is the maximum","Open the heightmap asset in the editor and fix the Floating Point Component Range field","Verify the serialized asset file contains correct X/Y order"],"exampleFix":"// before\nheightmapAsset.FloatingPointComponentRange = new Vector2(100f, 0f); // inverted\n// after\nheightmapAsset.FloatingPointComponentRange = new Vector2(0f, 100f);","handlingStrategy":"validation","validationCode":"var r = heightmapAsset.FloatingPointComponentRange;\nif (r.Y < r.X) throw new InvalidOperationException($\"FloatingPointComponentRange inverted: {r}\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set ranges in the editor UI, not by hand-editing asset files","Remember X is min, Y is max","Copy range values from logged terrain bounds","Validate asset properties in CI by loading assets headlessly"],"tags":["physics","heightmap","configuration"],"backgroundTag":"invalid-argument-value","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"}