HandyOrg/HandyControl · error · NotSupportedException

NotSupportedException

Error message

NotSupportedException

What it means

Thrown by ConvertBack to declare ThicknessSplitConverter forward-only: Convert multiplies each Thickness side by a factor parsed from a comma-separated parameter string, an operation with no unique inverse (the original factor and thickness cannot be recovered from the product). Any TwoWay or OneWayToSource binding that triggers reverse conversion hits this guard.

Solutions

  1. Use the converter exclusively in OneWay bindings so ConvertBack is never invoked
  2. If a reverse path is needed, implement ConvertBack to divide each side by the same parsed factor instead of throwing
  3. Return DependencyProperty.UnsetValue from ConvertBack for a graceful no-op when reverse updates should be ignored
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/Shared/HandyControl_Shared/Tools/Converter/ThicknessSplitConverter.cs:34 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HandyOrg/HandyControl@2c0875ebd6 (2026-09-14). Data as JSON: /api/errors/399fa5b43e8d0231. Report an issue: GitHub.

Appendix: source

Thrown at src/Shared/HandyControl_Shared/Tools/Converter/ThicknessSplitConverter.cs:34

        var arr = str.Split(',');

        if (arr.Length != 4)
        {
            return thickness;
        }

        return new Thickness(
            left: double.TryParse(arr[0], out double leftTimes) ? leftTimes * thickness.Left : thickness.Left,
            top: double.TryParse(arr[1], out double topTimes) ? topTimes * thickness.Top : thickness.Top,
            right: double.TryParse(arr[2], out double rightTimes) ? rightTimes * thickness.Right : thickness.Right,
            bottom: double.TryParse(arr[3], out double bottomTimes) ? bottomTimes * thickness.Bottom : thickness.Bottom
        );
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotSupportedException();
    }
}

View on GitHub (pinned to 2c0875ebd6)