{"record":{"id":"9d6bf3740161f84f","repo":"stride3d/stride","slug":"the-values-of-this-converter-must-be-convertible-to-a-double","errorCode":null,"errorMessage":"The values of this converter must be convertible to a double.","messagePattern":"The values of this converter must be convertible to a double\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/presentation/Stride.Core.Presentation.Wpf/ValueConverters/MultiplyMultiConverter.cs","lineNumber":25,"sourceCode":"\nnamespace Stride.Core.Presentation.ValueConverters\n{\n    public class MultiplyMultiConverter : OneWayMultiValueConverter<MultiplyMultiConverter>\n    {\n        [NotNull]\n        public override object Convert([NotNull] object[] values, Type targetType, object parameter, CultureInfo culture)\n        {\n            if (values.Length < 2)\n                throw new InvalidOperationException(\"This multi converter must be invoked with at least two elements\");\n\n            var result = 1.0;\n            try\n            {\n                result = values.Select(x => ConverterHelper.ConvertToDouble(x, culture)).Aggregate(result, (current, next) => current * next);\n            }\n            catch (Exception exception)\n            {\n                throw new ArgumentException(\"The values of this converter must be convertible to a double.\", exception);\n            }\n\n            return result;\n        }\n    }\n}\n","sourceCodeStart":7,"sourceCodeEnd":32,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/presentation/Stride.Core.Presentation.Wpf/ValueConverters/MultiplyMultiConverter.cs#L7-L32","documentation":"MultiplyMultiConverter converts each bound value to a double via ConverterHelper.ConvertToDouble and multiplies them. If any input value cannot be converted to a double, the underlying conversion throws and this library wraps it in an ArgumentException with the original exception as InnerException. This guards against silently producing NaN or 0 from non-numeric binding sources.","triggerScenarios":"Any element of the values array passed to Convert is a string that is not parseable as a double, a complex object, null handled non-numerically, or another type ConverterHelper.ConvertToDouble rejects, e.g. MultiBinding feeding a Path bound to a Brush or a malformed string.","commonSituations":"A binding points at a property whose type changed to string or a non-numeric model type after a refactor; a ComboBox selection object (not a number) is bound into the MultiBinding; a localized number string with wrong culture is supplied directly.","solutions":["Check the InnerException to identify which value failed to convert","Ensure every binding in the MultiBinding exposes a numeric (double-convertible) value","Use StringFormat or a prior converter stage to normalize string inputs to numbers","Validate the bound view-model properties return numeric types"],"exampleFix":"// before\n<Binding Path=\"ScaleText\"/> <!-- ScaleText is string \"fast\" -->\n// after\n<Binding Path=\"Scale\"/> <!-- Scale is double 1.5 -->","handlingStrategy":"try-catch","validationCode":"bool AllConvertibleToDouble(object[] values) =>\n    values != null && values.All(v => v is double || v is int || v is long || v is float || v is decimal || (v is string s && double.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out _)));","typeGuard":"bool IsNumeric(object v) => v is double || v is int || v is long || v is float || v is decimal || v is short || v is byte;","tryCatchPattern":"try\n{\n    return converter.Convert(values, typeof(double), null, culture);\n}\ncatch (ArgumentException ex)\n{\n    Log(ex.InnerException, \"Non-numeric value in MultiplyMultiConverter bindings\");\n    return 1.0;\n}","preventionTips":["Keep bound view-model properties numeric; avoid strings for numeric data","Use invariant culture when parsing user-entered numbers","Inspect InnerException to pinpoint the failing binding","Run resharper/analyzers on binding Path types where possible"],"tags":["wpf","multibinding","type-conversion","double"],"backgroundTag":"invalid-argument-value","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}