stride3d/stride · error · ArgumentOutOfRangeException
value
Error message
value
What it means
GestureConfigTap.RequiredNumberOfTaps throws ArgumentOutOfRangeException with paramName "value" when the assigned tap count is < 1. A tap gesture must require at least one tap; 0 or negative counts are meaningless.
Solutions
- Set RequiredNumberOfTaps to at least 1, e.g. RequiredNumberOfTaps = 2 for double-tap
- Guard uninitialized counters before assignment
- Use Math.Max(1, tapCount) when the value is computed
Example fix
// before tapConfig.RequiredNumberOfTaps = 0; // after tapConfig.RequiredNumberOfTaps = Math.Max(1, configuredTaps);
Defensive patterns
Strategy: validation
Validate before calling
if (taps < 1) throw new ArgumentException("RequiredNumberOfTaps must be >= 1");
tapConfig.RequiredNumberOfTaps = taps; Type guard
bool IsValidTapCount(int v) => v >= 1;
Try / catch
try { tapConfig.RequiredNumberOfTaps = taps; }
catch (ArgumentOutOfRangeException ex) when (ex.ParamName == "value")
{
tapConfig.RequiredNumberOfTaps = Math.Max(1, taps);
} Prevention
- Initialize tap-count settings to 1, not 0
- Clamp computed counts with Math.Max(1, count)
- Don't assume 0 means 'default'; the API requires >= 1
When it happens
Trigger: Assigning RequiredNumberOfTaps = 0 or a negative int on an unfrozen GestureConfigTap, e.g. an uninitialized counter or a config default of 0.
Common situations: Zero-initialized int fields in settings structures; loops that compute counts that can be 0; confusing '0 means default' conventions that this API does not support.
Related errors
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/879918f8bfc6254b.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Input/Gestures/GestureConfigTap.cs:27
/// </summary>
/// <remarks>A tap gesture can be composed of 1 or more fingers.</remarks>
public sealed class GestureConfigTap : GestureConfig
{
/// <summary>
/// This value represents the required number of successive user touches to trigger the gesture. For example: 1 for single touch, 2 for double touch, and so on...
/// </summary>
/// <remarks>This value is strictly positive.</remarks>
/// <exception cref="ArgumentOutOfRangeException">The given value is not greater or equal to 1.</exception>
/// <exception cref="InvalidOperationException">Tried to modify the configuration after it has been frozen by the system.</exception>
public int RequiredNumberOfTaps
{
get { return requiredNumberOfTaps; }
set
{
CheckNotFrozen();
if (value < 1)
throw new ArgumentOutOfRangeException("value");
requiredNumberOfTaps = value;
}
}
private int requiredNumberOfTaps;
/// <summary>
/// This value represents the maximum interval of time that can separate two touches of a same gesture.
/// By reducing this value, the system will tend to detect multi-touch gesture has several single touch gesture.
/// By increasing this value, the system will tend to regroup distant (in time) single touch gestures into a multi-touch gesture.
/// </summary>
public TimeSpan MaximumTimeBetweenTaps
{
get { return maximumTimeBetweenTaps; }
set
{
CheckNotFrozen();
View on GitHub (pinned to 96fad776d2)