{"record":{"id":"32e1d07f59a851f3","repo":"stride3d/stride","slug":"value-gestureconfigdrag","errorCode":null,"errorMessage":"value","messagePattern":"value","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Input/Gestures/GestureConfigDrag.cs","lineNumber":30,"sourceCode":"    /// <remarks>A drag gesture can be composed of 1 or more fingers.</remarks>\n    public sealed class GestureConfigDrag : GestureConfig\n    {\n        /// <summary>\n        /// Specify the minimum translation distance required  before that the gesture can be recognized as a Drag.\n        /// </summary>\n        /// <exception cref=\"InvalidOperationException\">Tried to modify the configuration after it has been frozen by the system.</exception>\n        /// <exception cref=\"ArgumentOutOfRangeException\">The provided value was negative.</exception>\n        /// <remarks>The user can reduce this value if he needs the drag gesture to be triggered even for very small drags.\n        /// On the contrary, he can increase this value if he wants to avoid to deals with too small drags.</remarks>\n        public float MinimumDragDistance\n        {\n            get { return minimumDragDistance; }\n            set\n            {\n                CheckNotFrozen();\n\n                if (value < 0)\n                    throw new ArgumentOutOfRangeException(\"value\");\n\n                minimumDragDistance = value;\n            }\n        }\n\n        private float minimumDragDistance;\n\n        /// <summary>\n        /// The (x,y) error margins allowed during directional dragging.\n        /// </summary>\n        /// <exception cref=\"InvalidOperationException\">Tried to modify the configuration after it has been frozen by the system.</exception>\n        /// <exception cref=\"ArgumentOutOfRangeException\">The provided x or y value was not positive.</exception>\n        /// <remarks>Those values are used only for directional (vertical or horizontal) dragging. \n        /// Decrease those values to trigger the gesture only when the dragging is perfectly in the desired direction.\n        /// Increase those values to allow directional gestures to be more approximative.</remarks>\n        public Vector2 AllowedErrorMargins\n        {\n            get { return allowedErrorMargins; }","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Input/Gestures/GestureConfigDrag.cs#L12-L48","documentation":"GestureConfigDrag.MinimumDragDistance throws ArgumentOutOfRangeException with paramName \"value\" when the assigned minimum drag distance is negative. The threshold distance is a magnitude; 0 is permitted, negative values are not.","triggerScenarios":"Assigning a negative float to MinimumDragDistance on an unfrozen GestureConfigDrag, usually from an unvalidated config value or an unsigned/signed conversion mistake.","commonSituations":"Reading thresholds from user-editable settings where a minus sign slipped in; computing distance from a vector without Abs(); sentinel -1 'unset' values in config files.","solutions":["Assign a non-negative distance, e.g. MinimumDragDistance = 20f","Wrap computed values with Math.Abs() before assignment","Validate/sanitize loaded config values before applying them"],"exampleFix":"// before\ndragConfig.MinimumDragDistance = -1f;\n// after\ndragConfig.MinimumDragDistance = 20f;","handlingStrategy":"validation","validationCode":"if (float.IsNaN(d) || d < 0f) throw new ArgumentException(\"MinimumDragDistance must be >= 0\");\ndragConfig.MinimumDragDistance = d;","typeGuard":"bool IsValidDistance(float v) => !float.IsNaN(v) && v >= 0f;","tryCatchPattern":"try { dragConfig.MinimumDragDistance = d; }\ncatch (ArgumentOutOfRangeException ex) when (ex.ParamName == \"value\")\n{\n    dragConfig.MinimumDragDistance = 20f;\n}","preventionTips":["Sanitize user-editable settings to reject negative thresholds","Use Math.Abs() on computed deltas","Avoid -1 'unset' sentinels for distance fields"],"tags":["csharp","argument-out-of-range","input","gestures"],"backgroundTag":"argument-out-of-range","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"}