{"record":{"id":"72f0bb3b87473bf7","repo":"dotnet/wpf","slug":"sr-doesnotsupportmultipleselection-windowstab","errorCode":null,"errorMessage":"SR.DoesNotSupportMultipleSelection","messagePattern":"SR\\.DoesNotSupportMultipleSelection","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/WindowsTab.cs","lineNumber":1113,"sourceCode":"            // If multiple selections allowed, add requested selection\n            if (WindowsTab.SupportMultipleSelection(_hwnd))\n            {\n                // Press ctrl and mouse click tab\n                NativeMethods.Win32Point pt = new NativeMethods.Win32Point();\n                if (GetClickablePoint(out pt, true))\n                {\n                    Input.SendKeyboardInput(Key.LeftCtrl, true);\n                    Misc.MouseClick(pt.x, pt.y);\n                    Input.SendKeyboardInput(Key.LeftCtrl, false);\n                    return;\n                }\n\n                throw new InvalidOperationException(SR.OperationCannotBePerformed);\n            }\n            // else only single selection allowed\n            else\n            {\n                throw new InvalidOperationException(SR.DoesNotSupportMultipleSelection);\n            }\n        }\n\n        // Removes this element from the selection\n        void ISelectionItemProvider.RemoveFromSelection()\n        {\n            // Make sure that the control is enabled\n            if (!SafeNativeMethods.IsWindowEnabled(_hwnd))\n            {\n                throw new ElementNotEnabledException();\n            }\n\n            // If not selected, done\n            if (!((ISelectionItemProvider)this).IsSelected)\n            {\n                return;\n            }\n","sourceCodeStart":1095,"sourceCodeEnd":1131,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/WindowsTab.cs#L1095-L1131","documentation":"WindowsTab's ISelectionItemProvider.Select throws InvalidOperationException with resource SR.DoesNotSupportMultipleSelection when code reaches a branch that permits multi-selection but the tab control only allows a single selection. The UIA Selection pattern contract requires the provider to reject a Select call that would create multiple selections on a control that does not support it. The proxy enforces the single-selection invariant of the Win32 tab control.","triggerScenarios":"Calling UIA SelectionItemPattern.Select() on a tab item of a Win32 tab control whose code path enters the multi-selection branch while the control allows only one selected item (e.g. TCS_MULTISELECT-style handling where only single selection is actually permitted).","commonSituations":"Automation scripts selecting tab items on classic Win32 tab controls; apps whose tab style changed between frameworks; UIA clients assuming Excel-like multi-select tabs.","solutions":["Do not call Select on a second tab while another is selected; call Select only on the desired tab item - the single-select control deselects the rest","Check SelectionPattern.CanSelectMultiple on the parent tab before issuing multi-select-style calls","Catch InvalidOperationException and treat it as 'operation unsupported for this control'","Recreate the automation sequence to model single selection instead of additive selection"],"exampleFix":"// before\nforeach (var tab in tabItems) tab.Select(); // additive multi-select\n// after\nforeach (var tab in tabItems) { if (!tab.Current.IsSelected) tab.Select(); } // ensures single selection","handlingStrategy":"validation","validationCode":"bool canAdditiveSelect = selectionPattern.Current.CanSelectMultiple; if (!canAdditiveSelect) throw new SkipSelectionException();","typeGuard":"bool IsMultiSelectable(AutomationElement el) => el.TryGetCurrentPattern(SelectionPattern.Pattern, out var p) && ((SelectionPattern)p).Current.CanSelectMultiple;","tryCatchPattern":null,"preventionTips":["Check SelectionPattern.CanSelectMultiple before multi-select-style calls","Treat tab items as single-select by default","Catch InvalidOperationException as unsupported-op signal"],"tags":["uiautomation","wpf","winforms-proxy","selection-item-pattern","tab-control"],"backgroundTag":"unsupported-operation","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}