stride3d/stride · error · InvalidOperationException
This multi converter must be invoked with at least two…
Error message
This multi converter must be invoked with at least two elements
What it means
AllEqualMultiConverter.Convert throws this InvalidOperationException when the MultiBinding supplies fewer than two values, since comparing 'all equal' is meaningless with zero or one element. The converter's contract requires at least two bound values.
Solutions
- Ensure the MultiBinding contains at least two child Bindings
- Verify the converter is attached via <MultiBinding.Converter>, not a single Binding
- Check child bindings for errors so values are not pruned to fewer than two
Example fix
// before
<Binding Path="A" Converter={StaticResource AllEqualMultiConverter}/>
// after
<MultiBinding Converter="{StaticResource AllEqualMultiConverter}">
<Binding Path="A"/>
<Binding Path="B"/>
</MultiBinding> Defensive patterns
Strategy: validation
Validate before calling
if (values == null || values.Length < 2)
throw new InvalidOperationException("MultiBinding must supply at least two values"); Type guard
bool HasTwoValues(object[] v) => v != null && v.Length >= 2;
Try / catch
try { result = AllEqualMultiConverter.Instance.Convert(values, targetType, param, culture); }
catch (InvalidOperationException ex) { Log.Warn("Multibinding under-populated", ex); } Prevention
- Always use MultiBinding with >= 2 child Bindings for multi converters
- Never attach multi converters to a plain Binding
- Review XAML for dropped/removed nested Bindings
- Convert to the WPF fallback values instead by passing a bool parameter
When it happens
Trigger: An IMultiValueConverter binding with a single child binding; all but one child binding failing to produce values; incorrectly wiring the converter to a plain Binding instead of a MultiBinding.
Common situations: XAML MultiBinding missing a nested Binding/Path element; a binding silently dropping values so the array shrinks; copy-pasting the converter into a normal Binding.
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
- This multi converter must be invoked with at least two…
- This converter supports only between two and eight elements
- This multi converter must be invoked with at least two…
- This multi converter must be invoked with at least two…
- This behavior must be attached to an instance of…
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/149feda63e4a394c.
Report an issue: GitHub.
Appendix: source
Thrown at sources/presentation/Stride.Core.Presentation.Wpf/ValueConverters/AllEqualMultiConverter.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.Linq;
using System.Windows;
using Stride.Core.Annotations;
using Stride.Core.Presentation.Internal;
namespace Stride.Core.Presentation.ValueConverters
{
public class AllEqualMultiConverter : OneWayMultiValueConverter<AllEqualMultiConverter>
{
[NotNull]
public override object Convert([NotNull] object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Length < 2)
throw new InvalidOperationException("This multi converter must be invoked with at least two elements");
var fallbackValue = parameter is bool && (bool)parameter;
var first = values[0];
var result = values.All(x => x == DependencyProperty.UnsetValue ? fallbackValue : Equals(x, first));
return result.Box();
}
}
}
View on GitHub (pinned to 96fad776d2)