{"record":{"id":"b9533727d70a27bf","repo":"HandyOrg/HandyControl","slug":"notsupportedexception-bordercircularclipconverter","errorCode":null,"errorMessage":"NotSupportedException","messagePattern":"NotSupportedException","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/Shared/HandyControl_Shared/Tools/Converter/BorderCircularClipConverter.cs","lineNumber":33,"sourceCode":"        if (values.Length == 3 && values[0] is double width && values[1] is double height && values[2] is CornerRadius radius)\n        {\n            if (width < double.Epsilon || height < double.Epsilon)\n            {\n                return Geometry.Empty;\n            }\n\n            var clip = new RectangleGeometry(new Rect(0, 0, width, height), radius.TopLeft, radius.TopLeft);\n            clip.Freeze();\n\n            return clip;\n        }\n\n        return DependencyProperty.UnsetValue;\n    }\n\n    public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)\n    {\n        throw new NotSupportedException();\n    }\n}\n","sourceCodeStart":15,"sourceCodeEnd":36,"githubUrl":"https://github.com/HandyOrg/HandyControl/blob/2c0875ebd67326e0c67282967e3e809c69282fee/src/Shared/HandyControl_Shared/Tools/Converter/BorderCircularClipConverter.cs#L15-L36","documentation":"BorderCircularClipConverter converts size/border data into a circular clip geometry and is one-way only; its ConvertBack unconditionally throws NotSupportedException. The library provides no reverse mapping from clip geometry back to the bound source values.","triggerScenarios":"Using BorderCircularClipConverter in a TwoWay/OneWayToSource binding or calling ConvertBack directly; binding an element's Clip/Geometry property with this converter in an editable control.","commonSituations":"Applying the converter in a control template where the binding defaults to TwoWay; copying a binding from another converter and forgetting the mode.","solutions":["Set Binding Mode=OneWay on the binding that uses this converter.","Write a custom converter with your own ConvertBack if reverse conversion is genuinely needed.","Move the binding source to a read-only property so WPF never invokes ConvertBack."],"exampleFix":"// before\n{Binding ActualWidth, Converter={StaticResource BorderCircularClipConverter}}\n// after\n{Binding ActualWidth, Mode=OneWay, Converter={StaticResource BorderCircularClipConverter}}","handlingStrategy":"type-guard","validationCode":"bool usesConverterBack = binding.Mode == BindingMode.TwoWay || binding.Mode == BindingMode.OneWayToSource;\nif (usesConverterBack && converter is BorderCircularClipConverter) throw new InvalidOperationException(\"Use Mode=OneWay with BorderCircularClipConverter\");","typeGuard":"static bool IsOneWay(BindingBase b) => b is Binding bd && bd.Mode == BindingMode.OneWay;","tryCatchPattern":"try { var result = converter.ConvertBack(value, targetTypes, parameter, culture); } catch (NotSupportedException) { return Array.Empty<object>(); // one-way converter\n}","preventionTips":["Set Mode=OneWay on bindings that use BorderCircularClipConverter.","Bind from read-only sources (ActualWidth, computed geometry) so ConvertBack is never called.","Create a dedicated converter subclass when back-conversion is needed."],"tags":["converter","wpf","clip","not-supported"],"backgroundTag":"unsupported-operation","analyzedSha":"2c0875ebd67326e0c67282967e3e809c69282fee","analyzedAt":"2026-09-14T14:45:29.754Z","contentChangedAt":"2026-09-14T14:45:29.754Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}