stride3d/stride · error · ArgumentOutOfRangeException

value

Error message

value

What it means

GestureConfigComposite.MinimumScale throws ArgumentOutOfRangeException with paramName "value" when the assigned scale is <= 1. The library requires a pinch's minimum scale factor to be strictly greater than 1 so the gesture only triggers on a genuine zoom-in. This is a configuration-time validation enforced after CheckNotFrozen().

Solutions

  1. Set MinimumScale to a value strictly greater than 1, e.g. 1.1f or 1.5f
  2. Verify the value source (config file, UI field) has a sensible non-unity default
  3. Add caller-side validation before assigning to fail early with a clearer message

Example fix

// before
compositeConfig.MinimumScale = 1f;
// after
compositeConfig.MinimumScale = 1.1f;
Defensive patterns

Strategy: validation

Validate before calling

if (float.IsNaN(minScale) || minScale <= 1f) throw new ArgumentException("MinimumScale must be > 1");
compositeConfig.MinimumScale = minScale;

Type guard

bool IsValidMinScale(float v) => !float.IsNaN(v) && v > 1f;

Try / catch

try { compositeConfig.MinimumScale = value; }
catch (ArgumentOutOfRangeException ex) when (ex.ParamName == "value")
{
    logger.LogWarning("MinimumScale {Value} invalid; using 1.1f", value);
    compositeConfig.MinimumScale = 1.1f;
}

Prevention

When it happens

Trigger: Assigning MinimumScale a value of 1, 0, negative, or any value not strictly greater than 1, e.g. compositeConfig.MinimumScale = 1f or = 0f, on an unfrozen GestureConfigComposite.

Common situations: Initializing gesture recognition config from user settings or designer fields that default to 0; assuming scale is a fraction (1.0 = no zoom) instead of a strict threshold; copy-pasting config code from drag/press gestures where 0 is valid.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/749c90ed337c91fb. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Input/Gestures/GestureConfigComposite.cs:33

    public sealed class GestureConfigComposite : GestureConfig
    {
        /// <summary>
        /// The scale value above which the gesture is started.
        /// </summary>
        /// <exception cref="ArgumentOutOfRangeException">The value has to be greater or equal to 1.</exception>
        /// <exception cref="InvalidOperationException">Tried to modify the configuration after it has been frozen by the system.</exception>
        /// <remarks>The user can increase this value if he has small or no interest in the scale component of the transformation. 
        /// By doing so, he avoids triggering the Composite Gesture when only small scale changes happen. 
        /// On the contrary, the user can decrease this value if he wants to be immediately warned about the smallest change in scale.</remarks>
        public float MinimumScaleValue
        {
            get { return minimumScaleValue; }
            set
            {
                CheckNotFrozen();

                if (value <= 1)
                    throw new ArgumentOutOfRangeException("value");

                minimumScaleValue = value;
                MinimumScaleValueInv = 1 / minimumScaleValue;
            }
        }
        private float minimumScaleValue;

        internal float MinimumScaleValueInv { get; set; }

        /// <summary>
        /// The translation distance above which the gesture is started.
        /// </summary>
        /// <exception cref="ArgumentOutOfRangeException">The value has to be positive.</exception>
        /// <exception cref="InvalidOperationException">Tried to modify the configuration after it has been frozen by the system.</exception>
        /// <remarks>The user can increase this value if he has small or no interest in the translation component of the transformation. 
        /// By doing so, he avoids triggering the Composite Gesture when only small translation changes happen. 
        /// On the contrary, the user can decrease this value if he wants to be immediately warned about the smallest change in translation.</remarks>
        public float MinimumTranslationDistance

View on GitHub (pinned to 96fad776d2)