stride3d/stride · error · NotSupportedException

ConvertBack is not supported with this ValueConverter.

Error message

ConvertBack is not supported with this ValueConverter.

What it means

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.

Solutions

  1. Set the binding Mode to OneWay explicitly.
  2. Replace the converter with one that implements ConvertBack if reverse conversion is required.
  3. Wrap the binding so ConvertBack is never called (e.g. use OneWay binding source-only updates).

Example fix

// before
<MultiBinding Converter="{StaticResource OrMulti}"> <!-- default mode may trigger ConvertBack -->
// after
<MultiBinding Converter="{StaticResource OrMulti}" Mode="OneWay">
Defensive patterns

Strategy: validation

Validate before calling

if (multiBinding is { } mb) mb.Mode = BindingMode.OneWay; // prevent ConvertBack calls

Type guard

static bool SupportsConvertBack(IValueConverter c) => !(c is OneWayMultiValueConverter<IMultiValueConverter>);

Try / catch

try { return converter.ConvertBack(value, targetTypes, parameter, culture); }
catch (NotSupportedException) { return Binding.DoNothing; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

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


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

Appendix: source

Thrown at sources/presentation/Stride.Core.Presentation.Wpf/ValueConverters/OneWayMultiValueConverter.cs:19

// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
using System;
using System.Globalization;
using System.Windows.Data;

namespace Stride.Core.Presentation.ValueConverters
{
    /// <summary>
    /// An abstract implementation of <see cref="MultiValueConverterBase{T}"/> that does not support <see cref="ConvertBack"/>.
    /// Invoking <see cref="ConvertBack"/> on this value converter will throw a <see cref="NotSupportedException"/>.
    /// </summary>
    /// <typeparam name="T">The type of <see cref="IMultiValueConverter"/> being implemented.</typeparam>
    public abstract class OneWayMultiValueConverter<T> : MultiValueConverterBase<T> where T : class, IMultiValueConverter, new()
    {
        /// <inheritdoc/>
        public sealed override object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotSupportedException("ConvertBack is not supported with this ValueConverter.");
        }
    }
}

View on GitHub (pinned to 96fad776d2)