HandyOrg/HandyControl · error · NotSupportedException
NotSupportedException
Error message
NotSupportedException
What it means
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.
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.
Example fix
// before
{Binding ActualWidth, Converter={StaticResource BorderCircularClipConverter}}
// after
{Binding ActualWidth, Mode=OneWay, Converter={StaticResource BorderCircularClipConverter}} Defensive patterns
Strategy: type-guard
Validate before calling
bool usesConverterBack = binding.Mode == BindingMode.TwoWay || binding.Mode == BindingMode.OneWayToSource;
if (usesConverterBack && converter is BorderCircularClipConverter) throw new InvalidOperationException("Use Mode=OneWay with BorderCircularClipConverter"); Type guard
static bool IsOneWay(BindingBase b) => b is Binding bd && bd.Mode == BindingMode.OneWay;
Try / catch
try { var result = converter.ConvertBack(value, targetTypes, parameter, culture); } catch (NotSupportedException) { return Array.Empty<object>(); // one-way converter
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Applying the converter in a control template where the binding defaults to TwoWay; copying a binding from another converter and forgetting the mode.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- NotSupportedException
- NotSupportedException
- NotSupportedException
- Specified type ' ' is not supported.
- Can't call EndInit without first calling BeginInit.
AI-assisted analysis of HandyOrg/HandyControl@2c0875ebd6 (2026-09-14).
Data as JSON: /api/errors/b9533727d70a27bf.
Report an issue: GitHub.
Appendix: source
Thrown at src/Shared/HandyControl_Shared/Tools/Converter/BorderCircularClipConverter.cs:33
if (values.Length == 3 && values[0] is double width && values[1] is double height && values[2] is CornerRadius radius)
{
if (width < double.Epsilon || height < double.Epsilon)
{
return Geometry.Empty;
}
var clip = new RectangleGeometry(new Rect(0, 0, width, height), radius.TopLeft, radius.TopLeft);
clip.Freeze();
return clip;
}
return DependencyProperty.UnsetValue;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
View on GitHub (pinned to 2c0875ebd6)