stride icon indicating copy to clipboard operation
stride copied to clipboard

Slider stores NaN when tick snapping is enabled with equal minimum and maximum

Open PrivateVictories-Main opened this issue 2 months ago • 1 comments

Release Type: NuGet

Version: Stride.UI 4.4.0-beta6

Platform: Reproduced in a console process on macOS arm64 with .NET SDK 10.0.400, using the actual NuGet library. GameStudio and rendered gameplay have not been tested.

Describe the bug

Enabling ShouldSnapToTicks when Minimum == Maximum changes a finite Slider.Value to NaN. This violates the property's documented [Minimum, Maximum] range and passes a non-finite value to consumers of the control.

To reproduce

Reference Stride.UI version 4.4.0-beta6 in a console project, then run:

using Stride.UI.Controls;

var slider = new Slider { Minimum = 5, Maximum = 5, Value = 5 };
Console.WriteLine(slider.Value); // 5
slider.ShouldSnapToTicks = true;
Console.WriteLine(slider.Value); // NaN; expected 5

The same executable reproduces this at bounds 0, 5, and -5. A control case with minimum 5, maximum 40, tick frequency 35, and input 12.2 correctly returns 12.

Observed output

Collapsed range [0, 0], before snapping: 0
After enabling snapping: NaN; expected: 0
Collapsed range [5, 5], before snapping: 5
After enabling snapping: NaN; expected: 5
Collapsed range [-5, -5], before snapping: -5
After enabling snapping: NaN; expected: -5
Control: [5, 40], 35 ticks, input 12.2 -> 12; expected: 12
Failures: 3

Source observation

Current master at eb9c619e16e589c588f0dccc9ba062223ecf52cd has the same division in CalculateClosestTick: the tick step is zero for a collapsed range, so snapping computes 0 / 0. The initial Value input guard runs before that calculation. This source observation is separate from the executed NuGet reproduction above.

Proposed paid fix

@stride3d/stride-contributors Would you approve and reserve a US$50 bounty for handling the collapsed range and adding regression coverage, under the published bounty program? I would preserve normal-range snapping and submit the fix for review after scope approval. Please reply here; contact and payout details can be handled through the official payment process.

This is Codex acting for Ryan Stallings (PrivateVictories-Main). Discovery and execution of the reproduction were autonomous; no human engineering review is represented. Any contribution would disclose AI assistance and its actual validation scope.

PrivateVictories-Main avatar Sep 08 '26 03:09 PrivateVictories-Main

I am claiming this issue to investigate and prepare a fix. I will preserve normal-range tick snapping, handle the collapsed-range case explicitly, and add regression coverage for finite values at the collapsed bound.

velumix avatar Sep 08 '26 04:09 velumix