{"record":{"id":"cbe496b39b835372","repo":"dotnet/wpf","slug":"sr-uia-operationcannotbeperformed-cbe496","errorCode":null,"errorMessage":"SR.UIA_OperationCannotBePerformed","messagePattern":"SR\\.UIA_OperationCannotBePerformed","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"info","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/GridViewColumnHeaderAutomationPeer.cs","lineNumber":71,"sourceCode":"                throw new ElementNotEnabledException();\n\n            GridViewColumnHeader owner = (GridViewColumnHeader)Owner;\n            owner.AutomationClick();\n        }\n\n        #region ITransformProvider\n\n        bool ITransformProvider.CanMove { get { return false; } }\n\n        //Note: CanResize can be false if Max/MinWidth,Height has been added on GridViewColumn/ColumnHeader\n        bool ITransformProvider.CanResize { get { return true; } }\n        bool ITransformProvider.CanRotate { get { return false; } }\n\n        //Note: Don't support Move so far, if users do need this feature to reorder columns, \n        //we can consider to add it later. (One concern is GVCH doesn't support reorder by moving itself)\n        void ITransformProvider.Move(double x, double y)\n        {\n            throw new InvalidOperationException(SR.UIA_OperationCannotBePerformed);\n        }\n\n        void ITransformProvider.Resize(double width, double height)\n        {\n            if (!IsEnabled())\n                throw new ElementNotEnabledException();\n\n            ArgumentOutOfRangeException.ThrowIfNegative(width);\n            ArgumentOutOfRangeException.ThrowIfNegative(height);\n\n            GridViewColumnHeader header = Owner as GridViewColumnHeader;\n            if (header != null)\n            {\n                header.Column?.Width = width;\n\n                header.Height = height;\n            }\n        }","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Automation/Peers/GridViewColumnHeaderAutomationPeer.cs#L53-L89","documentation":"GridViewColumnHeaderAutomationPeer implements ITransformProvider.Move by unconditionally throwing InvalidOperationException(SR.UIA_OperationCannotBePerformed). The WPF ListView/GridView column header does not support being moved via UI Automation, so the pattern advertises CanMove=false and any Move call fails. This is a deliberate 'operation not supported' contract, not a bug in the caller's code.","triggerScenarios":"Calling ITransformProvider.Move(x, y) on the automation peer of a GridViewColumnHeader (e.g. via UIA clients using the Transform pattern: Move() in a UIA test, or automation frameworks that call the Transform pattern on header elements).","commonSituations":"UI Automation tests or RPA scripts attempting to reorder ListView columns by moving the header element; accessibility tools exposing move gestures on column headers.","solutions":["Do not call Move on GridViewColumnHeader peers; check ITransformProvider.CanMove (returns false) before invoking Move.","Reorder columns via supported APIs instead: set GridViewColumnCollection index / GridViewColumn.Header, or simulate header drag through mouse-level automation.","Wrap the call in try-catch for InvalidOperationException and fall back to a different reorder mechanism if a generic automation driver always calls Move."],"exampleFix":"// before\ntransformPattern.Move(100, 0); // reorder column by moving header\n// after\nif (transformPatternCached.CanMove)\n{\n    transformPattern.Move(100, 0);\n}\nelse\n{\n    // reorder via GridViewColumnCollection instead\n    gridView.Columns.Move(oldIndex, newIndex);\n}","handlingStrategy":"try-catch","validationCode":"if (!transformPatternCached.CanMove) throwSkipOrFallback();","typeGuard":"bool CanMove(ITransformProvider t) => t is { CanMove: true };","tryCatchPattern":"try { transformPattern.Move(x, y); } catch (InvalidOperationException) { /* reorder via GridViewColumnCollection */ }","preventionTips":["Always check CanMove/CanRotate/CanResize capabilities on ITransformProvider before invoking methods.","Use GridViewColumnCollection.Move for column reordering instead of UIA Move.","Keep UIA pattern invocation generic but catch InvalidOperationException for unsupported operations."],"tags":["wpf","ui-automation","unsupported-operation"],"backgroundTag":"unsupported-operation","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"}