dotnet/wpf · warning · NotImplementedException
The method or operation is not implemented.
Error message
The method or operation is not implemented.
What it means
UIA proxy for WinForms spinner controls throws NotImplementedException from GetPatternProvider when a WinForms domain spinner is asked for a pattern it should nominally support (SelectionPattern) but cannot provide. Because the spinner is backed by an edit control, selection support requires each spinner item to have been reviewed at least once; this unusual intermediate state is surfaced by throwing instead of returning a provider. It signals an unhandled pattern-request combination inside the client-side provider, not a bug in caller code.
Solutions
- Traverse/review all items of the spinner at least once before querying SelectionPattern so the provider can supply it.
- Wrap pattern queries in try-catch for NotImplementedException and treat the pattern as unsupported when it fires.
- Query the element's supported patterns first via GetSupportedPatterns and skip SelectionPattern if not listed.
- If you own the WinForms app, replace the edit-control-based DomainUpDown with a ListBox/ComboBox-backed control that supports UIA SelectionPattern natively.
Example fix
// before
var pattern = spinner.GetCurrentPattern(SelectionPattern.Pattern);
// after
AutomationPattern[] supported = spinner.GetSupportedPatterns();
if (supported.Contains(SelectionPattern.Pattern))
{
var pattern = spinner.GetCurrentPattern(SelectionPattern.Pattern);
}
else
{
// fall back to Value/RangeValue pattern for edit-backed spinners
} Defensive patterns
Strategy: try-catch
Validate before calling
// C# (UIA client)
bool supportsSelection = element.GetSupportedPatterns()
.Contains(SelectionPattern.Pattern); Try / catch
try
{
var sel = element.GetCurrentPattern(SelectionPattern.Pattern) as SelectionPattern;
// use sel
}
catch (NotImplementedException)
{
// provider cannot supply SelectionPattern yet; fall back to Value/RangeValue
} Prevention
- Review/traverse all spinner items once before querying SelectionPattern on WinForms domain spinners.
- Check GetSupportedPatterns before requesting a specific pattern.
- Centralize pattern acquisition in a helper that maps NotImplementedException to unsupported.
When it happens
Trigger: A UI Automation client queries the SelectionPattern (via GetCurrentPattern/FindFirst with PropertyCondition on SelectionPatternIdentifiers.Pattern) on a WinForms DomainUpDown-style spinner whose items have not all been reviewed at least once; GetPatternProvider reaches the special-case branch and throws instead of returning null.
Common situations: Automating legacy WinForms apps containing DomainUpDown/NumericUpDown controls with tools like FlaUI, TestStack.White, or raw UIA COM clients; accessibility test runs that enumerate all supported patterns on every element; apps where the spinner's item list was populated but never traversed.
Related errors
- ' ' is not a valid value for this control.
- Element is not enabled.
- Element is not enabled.
- Element is not enabled.
- ElementNotAvailableException
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/acf1a6d21bb6fe5e.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/WinFormsSpinner.cs:236
{
if (iid == RangeValuePattern.Pattern && _type == SpinnerType.Numeric)
{
return this;
}
else if (_type == SpinnerType.Domain)
{
if (iid == ValuePattern.Pattern)
{
return this;
}
else if (iid == SelectionPattern.Pattern)
{
// Special case for a WinForms domain spinner. It is supposed to support
// SelectionPattern, but because it is based on an edit control, this is
// not possible unless each of the items in the spinner have been reviewed
// at least once. Call out this unusual case by throwing the following
// NotImplementedException.
throw new NotImplementedException();
}
}
return null;
}
#endregion
// ------------------------------------------------------
//
// ProxyFragment interface implementation
//
// ------------------------------------------------------
#region ProxyFragment Interface
// Returns a Proxy element corresponding to the specified screen coordinates.
internal override ProxySimple ElementProviderFromPoint(int x, int y)
{View on GitHub (pinned to 81131a70a4)