{"record":{"id":"718b08222d2a7d88","repo":"stride3d/stride","slug":"value-gestureconfigflick","errorCode":null,"errorMessage":"value","messagePattern":"value","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Input/Gestures/GestureConfigFlick.cs","lineNumber":28,"sourceCode":"    /// Configuration class for the Flick gesture.\n    /// </summary>\n    /// <remarks>A Flick gesture can be composed of 1 or more fingers.</remarks>\n    public sealed class GestureConfigFlick : GestureConfig\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        public Vector2 AllowedErrorMargins\n        {\n            get { return allowedErrorMargins; }\n            set\n            {\n                CheckNotFrozen();\n\n                if (value.X < 0 || value.Y < 0)\n                    throw new ArgumentOutOfRangeException(\"value\");\n\n                allowedErrorMargins = value;\n            }\n        }\n        private Vector2 allowedErrorMargins;\n\n        /// <summary>\n        /// The shape of the flick gesture.\n        /// </summary>        \n        /// <exception cref=\"InvalidOperationException\">Tried to modify the configuration after it has been frozen by the system.</exception>\n        public GestureShape FlickShape\n        {\n            get { return flickShape; }\n            set\n            {\n                CheckNotFrozen();\n\n                flickShape = value;","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Input/Gestures/GestureConfigFlick.cs#L10-L46","documentation":"GestureConfigFlick.AllowedErrorMargin throws ArgumentOutOfRangeException with paramName \"value\" when either X or Y of the Vector2 is negative. It defines the directional tolerance cone for flick recognition, so both components must be >= 0.","triggerScenarios":"Assigning a Vector2 with a negative component to AllowedErrorMargin on an unfrozen GestureConfigFlick, commonly from signed delta or angle math.","commonSituations":"Reusing drag-gesture margin values computed with signs; subtracting screen coordinates without normalizing; negative sentinel values in config.","solutions":["Provide a Vector2 with both components >= 0, e.g. new Vector2(5, 5)","Take absolute values of computed components before assignment","Validate values loaded from settings before assigning"],"exampleFix":"// before\nflickConfig.AllowedErrorMargin = new Vector2(dx, dy); // dx < 0\n// after\nflickConfig.AllowedErrorMargin = new Vector2(Math.Abs(dx), Math.Abs(dy));","handlingStrategy":"validation","validationCode":"if (margin.X < 0f || margin.Y < 0f) throw new ArgumentException(\"AllowedErrorMargin components must be >= 0\");\nflickConfig.AllowedErrorMargin = margin;","typeGuard":"bool IsValidMargin(Vector2 v) => v.X >= 0f && v.Y >= 0f;","tryCatchPattern":"try { flickConfig.AllowedErrorMargin = margin; }\ncatch (ArgumentOutOfRangeException ex) when (ex.ParamName == \"value\")\n{\n    flickConfig.AllowedErrorMargin = Vector2.Abs(margin);\n}","preventionTips":["Normalize flick direction math before reusing values as margins","Validate Vector2 config fields component-wise","Keep margin values separate from signed screen-coordinate math"],"tags":["csharp","argument-out-of-range","vector2","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-16T04:17:20.429Z"}