HandyOrg/HandyControl · error · NotSupportedException
NotSupportedException
Error message
NotSupportedException
What it means
BorderClipConverter produces a clip geometry for border elements (returning DependencyProperty.UnsetValue for degenerate sizes) and is one-way; ConvertBack unconditionally throws NotSupportedException. Reverse conversion from clip geometry back to the source value is intentionally not provided.
Solutions
- Set Binding Mode=OneWay on bindings using BorderClipConverter.
- Write a custom converter with a real ConvertBack if you need two-way behavior.
- Use the converter only on decorative clip properties, not on data properties.
Example fix
// before
{Binding ActualWidth, Converter={StaticResource BorderClipConverter}}
// after
{Binding ActualWidth, Mode=OneWay, Converter={StaticResource BorderClipConverter}} Defensive patterns
Strategy: type-guard
Validate before calling
bool usesConverterBack = binding.Mode == BindingMode.TwoWay || binding.Mode == BindingMode.OneWayToSource;
if (usesConverterBack && converter is BorderClipConverter) throw new InvalidOperationException("Use Mode=OneWay with BorderClipConverter"); 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 every binding that uses BorderClipConverter.
- Use the converter only for Clip/geometry decoration, never on data-bound two-way properties.
- Audit control templates (TextBox, ComboBox) after restyling to confirm no TwoWay clip bindings remain.
When it happens
Trigger: Using BorderClipConverter in a TwoWay/OneWayToSource binding, or calling ConvertBack directly; applying it on an editable control whose properties bind TwoWay by default.
Common situations: Styling TextBox/ComboBox templates with this clip converter and missing the OneWay mode; copying the converter usage between read-only and editable elements.
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/7b8275476f0aaa51.
Report an issue: GitHub.
Appendix: source
Thrown at src/Shared/HandyControl_Shared/Tools/Converter/BorderClipConverter.cs:47
new ArcSegment(new Point(width - radius.BottomRight, height), new Size(radius.BottomRight, radius.BottomRight), 90, false, SweepDirection.Clockwise, false),
new LineSegment(new Point(radius.BottomLeft, height), false),
new ArcSegment(new Point(0, height - radius.BottomLeft), new Size(radius.BottomLeft, radius.BottomLeft), 90, false, SweepDirection.Clockwise, false),
new LineSegment(new Point(0, radius.TopLeft), false),
new ArcSegment(new Point(radius.TopLeft, 0), new Size(radius.TopLeft, radius.TopLeft), 90, false, SweepDirection.Clockwise, false),
}, false)
}
};
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)