stride3d/stride · error · ArgumentException

The parameter of this converter must be convertible to a…

Error message

The parameter of this converter must be convertible to a double.

What it means

Multiply.Convert requires the converter parameter to be convertible to a double via ConverterHelper.ConvertToDouble. When the parameter is a non-numeric type or an unparsable string, the underlying exception is wrapped in an ArgumentException indicating the parameter is at fault.

Solutions

  1. Set ConverterParameter to a valid numeric string, e.g. ConverterParameter="1.5".
  2. Use invariant decimal point format (.) in XAML parameters.
  3. Pass the parameter programmatically as a double when constructing the binding in code.

Example fix

<!-- before -->
<Binding Converter="{StaticResource multiply}" ConverterParameter="1,5"/>
<!-- after -->
<Binding Converter="{StaticResource multiply}" ConverterParameter="1.5"/>
Defensive patterns

Strategy: validation

Validate before calling

bool isValidParameter(object? p) => p is double || p is int || (p is string s && double.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out _));

Try / catch

try { result = multiply.Convert(value, targetType, parameter, culture); } catch (ArgumentException) { result = DependencyProperty.UnsetValue; }

Prevention

When it happens

Trigger: ConverterParameter set to a non-numeric string in XAML (e.g. ConverterParameter="scale"), or a parameter object whose type ConvertToDouble cannot handle.

Common situations: Typos in XAML ConverterParameter (text where a number was intended); culture-sensitive decimal commas in XAML attributes; forgetting that ConverterParameter is a string in XAML.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/3a22f332b1b1a88b. Report an issue: GitHub.

Appendix: source

Thrown at sources/presentation/Stride.Core.Presentation.Wpf/ValueConverters/Multiply.cs:37

        {
            double scalar;
            try
            {
                scalar = ConverterHelper.ConvertToDouble(value, culture);
            }
            catch (Exception exception)
            {
                throw new ArgumentException("The value of this converter must be convertible to a double.", exception);
            }

            double param;
            try
            {
                param = ConverterHelper.ConvertToDouble(parameter, culture);
            }
            catch (Exception exception)
            {
                throw new ArgumentException("The parameter of this converter must be convertible to a double.", exception);
            }

            return System.Convert.ChangeType(scalar * param, targetType);
        }

        /// <inheritdoc/>
        public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            double scalar;
            try
            {
                scalar = ConverterHelper.ConvertToDouble(value, culture);
            }
            catch (Exception exception)
            {
                throw new ArgumentException("The value of this converter must be convertible to a double.", exception);
            }

View on GitHub (pinned to 96fad776d2)