{"record":{"id":"1a5e85e1d50b186d","repo":"stride3d/stride","slug":"convertback-is-not-supported-with-this-valueconverter","errorCode":null,"errorMessage":"ConvertBack is not supported with this ValueConverter.","messagePattern":"ConvertBack is not supported with this ValueConverter\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/presentation/Stride.Core.Presentation.Wpf/ValueConverters/OneWayMultiValueConverter.cs","lineNumber":19,"sourceCode":"// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)\n// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.\nusing System;\nusing System.Globalization;\nusing System.Windows.Data;\n\nnamespace Stride.Core.Presentation.ValueConverters\n{\n    /// <summary>\n    /// An abstract implementation of <see cref=\"MultiValueConverterBase{T}\"/> that does not support <see cref=\"ConvertBack\"/>.\n    /// Invoking <see cref=\"ConvertBack\"/> on this value converter will throw a <see cref=\"NotSupportedException\"/>.\n    /// </summary>\n    /// <typeparam name=\"T\">The type of <see cref=\"IMultiValueConverter\"/> being implemented.</typeparam>\n    public abstract class OneWayMultiValueConverter<T> : MultiValueConverterBase<T> where T : class, IMultiValueConverter, new()\n    {\n        /// <inheritdoc/>\n        public sealed override object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)\n        {\n            throw new NotSupportedException(\"ConvertBack is not supported with this ValueConverter.\");\n        }\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":23,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/presentation/Stride.Core.Presentation.Wpf/ValueConverters/OneWayMultiValueConverter.cs#L1-L23","documentation":"OneWayMultiValueConverter<T> is a base class for converters that only support one-way multi-value conversion; its ConvertBack is sealed and unconditionally throws NotSupportedException. It exists so authors of one-way converters cannot accidentally provide a meaningless reverse conversion, and to give a clear message instead of a NullReferenceException or wrong result.","triggerScenarios":"Using a converter that derives from OneWayMultiValueConverter<T> (e.g. OrMultiConverter, SubtractMultiConverter, SumMultiConverter) in a binding whose Mode is TwoWay or OneWayToSource, causing WPF to call ConvertBack.","commonSituations":"Forgetting to set Binding Mode=OneWay on a MultiBinding in XAML; attaching an arithmetic converter to a TwoWay TextBox binding; WPF defaults some properties to TwoWay (e.g. TextBox.Text) so the default mode silently invokes ConvertBack.","solutions":["Set the binding Mode to OneWay explicitly.","Replace the converter with one that implements ConvertBack if reverse conversion is required.","Wrap the binding so ConvertBack is never called (e.g. use OneWay binding source-only updates)."],"exampleFix":"// before\n<MultiBinding Converter=\"{StaticResource OrMulti}\"> <!-- default mode may trigger ConvertBack -->\n// after\n<MultiBinding Converter=\"{StaticResource OrMulti}\" Mode=\"OneWay\">","handlingStrategy":"validation","validationCode":"if (multiBinding is { } mb) mb.Mode = BindingMode.OneWay; // prevent ConvertBack calls","typeGuard":"static bool SupportsConvertBack(IValueConverter c) => !(c is OneWayMultiValueConverter<IMultiValueConverter>);","tryCatchPattern":"try { return converter.ConvertBack(value, targetTypes, parameter, culture); }\ncatch (NotSupportedException) { return Binding.DoNothing; }","preventionTips":["Set Mode=OneWay on MultiBindings using one-way-only converters","Check the converter's base class before using it in TwoWay bindings","Note that TextBox.Text and similar default to TwoWay","Verify with sealed ConvertBack in decompiled source when unsure"],"tags":["wpf","valueconverter","notsupported","binding"],"backgroundTag":"unsupported-operation","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"}