stride3d/stride · error · ArgumentException

Property unsupported by method UpdateValueFromComponent.

Error message

Property unsupported by method UpdateValueFromComponent.

What it means

Int2Editor.UpdateValueFromComponent maps the individual X/Y DependencyProperties back to a combined Int2 value. If the passed property is neither XProperty nor YProperty, the editor has no rule to build an Int2 from it, so it throws ArgumentException to signal a programming error in the caller rather than silently returning a wrong value.

Solutions

  1. Ensure only XProperty and YProperty are routed into UpdateValueFromComponent
  2. If a new component DependencyProperty was added (e.g. a Z), extend the if-chain to handle it before the throw
  3. Override UpdateValueFromComponent in a subclass and handle your custom properties instead of calling the base implementation
  4. Check the call stack to identify which DependencyProperty change was mis-routed

Example fix

// before
if (property == YProperty)
    return Y.HasValue && Value.HasValue ? (Int2?)new Int2(Value.Value.X, Y.Value) : null;
throw new ArgumentException("Property unsupported by method UpdateValueFromComponent.");
// after
if (property == YProperty)
    return Y.HasValue && Value.HasValue ? (Int2?)new Int2(Value.Value.X, Y.Value) : null;
if (property == MyExtraProperty) // handle any newly added component property
    return ComputeFromExtra();
throw new ArgumentException($"Property unsupported by method UpdateValueFromComponent: {property.Name}");
Defensive patterns

Strategy: validation

Validate before calling

// before routing a property change
bool isKnownComponent = property == Int2Editor.XProperty || property == Int2Editor.YProperty;
if (!isKnownComponent) throw new InvalidOperationException($"{property.Name} is not an Int2 component property");

Type guard

bool IsInt2ComponentProperty(DependencyProperty p) => p == Int2Editor.XProperty || p == Int2Editor.YProperty;

Try / catch

try { editor.UpdateValueFromComponent(prop); }
catch (ArgumentException ex) { log.Warn($"Unsupported property for Int2Editor: {ex.Message}"); }

Prevention

When it happens

Trigger: Calling or invoking the X/Y property-changed path with a DependencyProperty other than XProperty or YProperty — e.g. a subclass binds an extra DP and routes it through UpdateValueFromComponent, or base-class plumbing forwards a unrelated property change.

Common situations: Custom editor subclasses overriding or reusing the component-update plumbing of Stride vector editors; refactors that rename or add DependencyProperties without extending the if-chain; WPF bindings mistakenly attached to the editor's non-component properties.

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/02306954f906a544. Report an issue: GitHub.

Appendix: source

Thrown at sources/presentation/Stride.Core.Presentation.Wpf/Controls/Int2Editor.cs:50

        /// <inheritdoc/>
        protected override void UpdateComponentsFromValue(Int2? value)
        {
            if (value != null)
            {
                SetCurrentValue(XProperty, value.Value.X);
                SetCurrentValue(YProperty, value.Value.Y);
            }
        }

        /// <inheritdoc/>
        protected override Int2? UpdateValueFromComponent(DependencyProperty property)
        {
            if (property == XProperty)
                return X.HasValue && Value.HasValue ? (Int2?)new Int2(X.Value, Value.Value.Y) : null;
            if (property == YProperty)
                return Y.HasValue && Value.HasValue ? (Int2?)new Int2(Value.Value.X, Y.Value) : null;
              
            throw new ArgumentException("Property unsupported by method UpdateValueFromComponent.");
        }

        /// <inheritdoc/>
        protected override Int2? UpdateValueFromFloat(float value)
        {
            return new Int2((int)Math.Round(value, MidpointRounding.AwayFromZero));
        }
    }
}

View on GitHub (pinned to 96fad776d2)