{"record":{"id":"8add38d760d9d7cb","repo":"dotnet/wpf","slug":"sr-uia-operationcannotbeperformed","errorCode":null,"errorMessage":"SR.UIA_OperationCannotBePerformed","messagePattern":"SR\\.UIA_OperationCannotBePerformed","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/GridSplitterAutomationPeer.cs","lineNumber":52,"sourceCode":"        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}\n\n","sourceCodeStart":34,"sourceCodeEnd":63,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/GridSplitterAutomationPeer.cs#L34-L63","documentation":"GridSplitterAutomationPeer explicitly rejects resizing: ITransformProvider.Resize always throws InvalidOperationException(SR.UIA_OperationCannotBePerformed). The peer reports CanResize=false, and UIA convention is to throw this exception if a client still attempts the unsupported operation.","triggerScenarios":"A UIA client calls ITransformProvider.Resize on a GridSplitter element despite the Transform pattern's CanResize property being false.","commonSituations":"Generic test drivers that invoke every pattern method without checking capability properties like CanResize; tools recording and replaying transform operations on elements whose capabilities differ.","solutions":["Do not call Resize on GridSplitter; check CanResize first and skip when false.","Set the splitter's resize behavior via ResizeDirection/ResizeBehavior properties in XAML instead of the UIA Transform pattern.","Catch InvalidOperationException from Resize and treat as operation-not-supported.","Use the Grid's ColumnDefinition/RowDefinition manipulation (e.g. GridResizeBehavior) as the supported resizing mechanism."],"exampleFix":"// before\n((ITransformProvider)peer).Resize(120, 30);\n// after\nif (((ITransformProvider)peer).CanResize) ((ITransformProvider)peer).Resize(120, 30);\nelse splitter.ResizeDirection = GridResizeDirection.Columns;","handlingStrategy":"validation","validationCode":"if (!((ITransformProvider)peer).CanResize) throw new NotSupportedException(\"GridSplitter cannot be resized via Transform pattern\");","typeGuard":null,"tryCatchPattern":"try { ((ITransformProvider)peer).Resize(w, h); }\ncatch (InvalidOperationException) { /* unsupported: use XAML resize behavior */ }","preventionTips":["Always check CanResize before Resize","Configure GridSplitter via ResizeDirection/ResizeBehavior in XAML","Skip unsupported pattern methods in generic test drivers"],"tags":["wpf","ui-automation","unsupported-operation","grid-splitter"],"backgroundTag":"operation-not-supported","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"}