{"record":{"id":"ba986cf427906acb","repo":"stride3d/stride","slug":"the-smallstep-should-be-lesser-or-equal-to-the-largestep","errorCode":null,"errorMessage":"The smallStep should be lesser or equal to the largeStep.","messagePattern":"The smallStep should be lesser or equal to the largeStep\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core/Annotations/DataMemberRangeAttribute.cs","lineNumber":41,"sourceCode":"        DecimalPlaces = decimalPlaces;\n    }\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"DataMemberRangeAttribute\" /> class.\n    /// </summary>\n    /// <param name=\"minimum\">The minimum.</param>\n    /// <param name=\"maximum\">The maximum.</param>\n    /// <param name=\"smallStep\">The minimum step used to go from minimum to maximum.</param>\n    /// <param name=\"largeStep\">The maximum step used to go from minimum to maximum.</param>\n    /// <param name=\"decimalPlaces\">The decimal places.</param>\n    public DataMemberRangeAttribute(double minimum, double maximum, double smallStep, double largeStep, int decimalPlaces)\n        : this(minimum, decimalPlaces)\n    {\n        if (double.IsNaN(maximum)) throw new ArgumentOutOfRangeException(nameof(maximum));\n        if (minimum > maximum) throw new ArgumentException(\"The minimum should be lesser or equal to the maximum.\", nameof(minimum));\n        if (double.IsNaN(smallStep)) throw new ArgumentOutOfRangeException(nameof(smallStep));\n        if (double.IsNaN(largeStep)) throw new ArgumentOutOfRangeException(nameof(largeStep));\n        if (smallStep > largeStep) throw new ArgumentException(\"The smallStep should be lesser or equal to the largeStep.\", nameof(smallStep));\n        if (decimalPlaces < 0) throw new ArgumentException(\"The decimalPlaces should be greater or equal to zero.\", nameof(decimalPlaces));\n        Maximum = maximum;\n        SmallStep = smallStep;\n        LargeStep = largeStep;\n    }\n\n    /// <summary>\n    /// Gets the minimum inclusive.\n    /// </summary>\n    /// <value>The minimum.</value>\n    public double? Minimum { get; }\n\n    /// <summary>\n    /// Gets the maximum inclusive.\n    /// </summary>\n    /// <value>The maximum.</value>\n    public double? Maximum { get; }\n","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core/Annotations/DataMemberRangeAttribute.cs#L23-L59","documentation":"The five-parameter DataMemberRangeAttribute constructor throws ArgumentException with 'The smallStep should be lesser or equal to the largeStep.' when smallStep > largeStep. smallStep/largeStep control fine/coarse increments from minimum to maximum (e.g. slider ticks); having the fine step exceed the coarse step is inconsistent and rejected.","triggerScenarios":"Writing [DataMemberRange(0.0, 1.0, 0.5, 0.1, 2)] where the small step (0.5) exceeds the large step (0.1). Only reached after minimum/maximum/NaN checks pass.","commonSituations":"Configuring editor sliders for Stride asset properties; argument-order confusion after refactoring; copied attribute lines where steps were edited to cross.","solutions":["Order the steps: make smallStep <= largeStep (e.g. smallStep 0.1, largeStep 1.0).","Verify argument positions in the constructor signature (minimum, maximum, smallStep, largeStep, decimalPlaces).","Compute steps from the range programmatically and clamp: smallStep = Math.Min(smallStep, largeStep)."],"exampleFix":"// before\n[DataMemberRange(0.0, 1.0, 0.5, 0.1, 2)]\npublic float Volume { get; set; }\n// after\n[DataMemberRange(0.0, 1.0, 0.1, 0.5, 2)]\npublic float Volume { get; set; }","handlingStrategy":"validation","validationCode":"if (smallStep > largeStep)\n    throw new ArgumentException($\"smallStep {smallStep} must be <= largeStep {largeStep}.\");\n// then apply: [DataMemberRange(min, max, smallStep, largeStep, decimals)]","typeGuard":"static bool AreValidSteps(double smallStep, double largeStep) => !double.IsNaN(smallStep) && !double.IsNaN(largeStep) && smallStep <= largeStep;","tryCatchPattern":"try\n{\n    var attr = new DataMemberRangeAttribute(min, max, smallStep, largeStep, decimals);\n}\ncatch (ArgumentException ex)\n{\n    log.Error(\"Invalid DataMemberRange steps: \" + ex.Message);\n}","preventionTips":["Derive largeStep as a multiple of smallStep (e.g. largeStep = smallStep * 10).","Clamp with Math.Min when computing steps programmatically.","Document step semantics (fine/coarse) next to each attributed property to prevent swaps."],"tags":["invalid-argument-value","csharp","attributes"],"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"}