{"record":{"id":"ef91e20638016543","repo":"dotnet/wpf","slug":"argumentoutofrangeexception-gridsplitterautomationpeer","errorCode":null,"errorMessage":"ArgumentOutOfRangeException","messagePattern":"ArgumentOutOfRangeException","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/GridSplitterAutomationPeer.cs","lineNumber":43,"sourceCode":"            if (patternInterface == PatternInterface.Transform)\n                return this;\n            else\n                return base.GetPattern(patternInterface); \n        }\n\n        #region ITransformProvider\n\n        bool ITransformProvider.CanMove { get { return true; } }\n        bool ITransformProvider.CanResize { get { return false; } }\n        bool ITransformProvider.CanRotate { get { return false; } }\n\n        void ITransformProvider.Move(double x, double y)\n        {\n            if (!IsEnabled())\n                throw new ElementNotEnabledException();\n\n            if (double.IsInfinity(x) || double.IsNaN(x))\n                throw new ArgumentOutOfRangeException(nameof(x));\n\n            if (double.IsInfinity(y) || double.IsNaN(y))\n                throw new ArgumentOutOfRangeException(nameof(y));\n\n            ((GridSplitter)Owner).KeyboardMoveSplitter(x, y);\n        }\n        void ITransformProvider.Resize(double width, double height)\n        {\n            throw new InvalidOperationException(SR.UIA_OperationCannotBePerformed);\n        }\n        void ITransformProvider.Rotate(double degrees)\n        {\n            throw new InvalidOperationException(SR.UIA_OperationCannotBePerformed);\n        }\n\n        #endregion\n    }\n}","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/GridSplitterAutomationPeer.cs#L25-L61","documentation":"ITransformProvider.Move on GridSplitterAutomationPeer validates its arguments after the enabled check: a double.IsInfinity or double.IsNaN x coordinate throws ArgumentOutOfRangeException(nameof(x)). The splitter can only be moved by finite deltas.","triggerScenarios":"Calling Move with x = double.PositiveInfinity, double.NegativeInfinity, or NaN — typically from computed coordinates that divided by zero or were passed uninitialized from UIA automation code.","commonSituations":"Test scripts computing delta from measurements that produce NaN (0/0), uninitialized double fields, or translation of screen coordinates where a divide-by-width yielded Infinity.","solutions":["Validate/clamp x to a finite value before calling Move (double.IsFinite check).","Fix the upstream coordinate computation producing Infinity/NaN (guard divisions by zero).","Catch ArgumentOutOfRangeException in the caller and log the bad input.","Use KeyboardMoveSplitter via UI only with deltas derived from actual element bounds."],"exampleFix":"// before\ntransform.Move(dx, dy); // dx may be NaN\n// after\nif (double.IsFinite(dx)) transform.Move(dx, dy);","handlingStrategy":"validation","validationCode":"if (!double.IsFinite(x)) throw new ArgumentException(\"x must be finite\");","typeGuard":"static bool IsFiniteDelta(double d) => !double.IsNaN(d) && !double.IsInfinity(d);","tryCatchPattern":"try { ((ITransformProvider)peer).Move(x, y); }\ncatch (ArgumentOutOfRangeException ex) { /* log invalid coordinate */ }","preventionTips":["Guard coordinate math against division by zero","Validate NaN/Infinity before UIA calls","Log deltas in test harnesses"],"tags":["wpf","ui-automation","argument-validation","grid-splitter"],"backgroundTag":"invalid-argument-value","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-22T01:17:13.364Z"}