dotnet/wpf · error · ArgumentOutOfRangeException
ArgumentOutOfRangeException
Error message
ArgumentOutOfRangeException
What it means
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.
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.
Example fix
// before transform.Move(dx, dy); // dx may be NaN // after if (double.IsFinite(dx)) transform.Move(dx, dy);
Defensive patterns
Strategy: validation
Validate before calling
if (!double.IsFinite(x)) throw new ArgumentException("x must be finite"); Type guard
static bool IsFiniteDelta(double d) => !double.IsNaN(d) && !double.IsInfinity(d);
Try / catch
try { ((ITransformProvider)peer).Move(x, y); }
catch (ArgumentOutOfRangeException ex) { /* log invalid coordinate */ } Prevention
- Guard coordinate math against division by zero
- Validate NaN/Infinity before UIA calls
- Log deltas in test harnesses
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- ElementNotEnabledException
- SR.TextRangeProvider_EmptyStringParameter
- SR.TextRangeProvider_InvalidParameterValue
- SR.UIA_OperationCannotBePerformed
- ' ' is not a valid value for ' '.
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/ef91e20638016543.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/GridSplitterAutomationPeer.cs:43
if (patternInterface == PatternInterface.Transform)
return this;
else
return base.GetPattern(patternInterface);
}
#region ITransformProvider
bool ITransformProvider.CanMove { get { return true; } }
bool ITransformProvider.CanResize { get { return false; } }
bool ITransformProvider.CanRotate { get { return false; } }
void ITransformProvider.Move(double x, double y)
{
if (!IsEnabled())
throw new ElementNotEnabledException();
if (double.IsInfinity(x) || double.IsNaN(x))
throw new ArgumentOutOfRangeException(nameof(x));
if (double.IsInfinity(y) || double.IsNaN(y))
throw new ArgumentOutOfRangeException(nameof(y));
((GridSplitter)Owner).KeyboardMoveSplitter(x, y);
}
void ITransformProvider.Resize(double width, double height)
{
throw new InvalidOperationException(SR.UIA_OperationCannotBePerformed);
}
void ITransformProvider.Rotate(double degrees)
{
throw new InvalidOperationException(SR.UIA_OperationCannotBePerformed);
}
#endregion
}
}View on GitHub (pinned to 81131a70a4)