stride3d/stride · error · ArgumentException

Property unsupported by method UpdateValueFromComponent.

Error message

Property unsupported by method UpdateValueFromComponent.

What it means

Int4Editor.UpdateValueFromComponent maps changes to XProperty/YProperty/ZProperty/WProperty back into a combined Int4. An unrecognized DependencyProperty means a contract violation by the caller and results in ArgumentException rather than a silently incorrect vector value.

Solutions

  1. Only pass XProperty, YProperty, ZProperty, or WProperty to UpdateValueFromComponent
  2. Extend the mapping chain if a new component DependencyProperty was introduced
  3. Override UpdateValueFromComponent in your subclass for custom properties
  4. Inspect the ArgumentException stack trace to identify the offending property

Example fix

// before
if (property == WProperty)
    return W.HasValue && Value.HasValue ? (Int4?)new Int4(Value.Value.X, Value.Value.Y, Value.Value.Z, W.Value) : null;
throw new ArgumentException("Property unsupported by method UpdateValueFromComponent.");
// after
if (property == WProperty)
    return W.HasValue && Value.HasValue ? (Int4?)new Int4(Value.Value.X, Value.Value.Y, Value.Value.Z, W.Value) : null;
throw new ArgumentException($"Property unsupported by method UpdateValueFromComponent: {property?.Name}"); // clearer diagnostics
Defensive patterns

Strategy: validation

Validate before calling

bool ok = property == Int4Editor.XProperty || property == Int4Editor.YProperty || property == Int4Editor.ZProperty || property == Int4Editor.WProperty;
if (!ok) throw new InvalidOperationException($"{property.Name} is not an Int4 component property");

Type guard

bool IsInt4ComponentProperty(DependencyProperty p) => p == Int4Editor.XProperty || p == Int4Editor.YProperty || p == Int4Editor.ZProperty || p == Int4Editor.WProperty;

Try / catch

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

Prevention

When it happens

Trigger: Calling UpdateValueFromComponent with a DependencyProperty other than X/Y/Z/W — e.g. subclass-added DPs or mis-wired change callbacks forwarded to the base implementation.

Common situations: Custom vector editor subclasses reusing the component plumbing with extra DPs; refactors adding a new component property without updating the if-chain; template or binding mistakes that trigger value coercion for unrelated 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/dcbd324afcbfdbb3. Report an issue: GitHub.

Appendix: source

Thrown at sources/presentation/Stride.Core.Presentation.Wpf/Controls/Int4Editor.cs:76

                SetCurrentValue(YProperty, value.Value.Y);
                SetCurrentValue(ZProperty, value.Value.Z);
                SetCurrentValue(WProperty, value.Value.W);
            }
        }

        /// <inheritdoc/>
        protected override Int4? UpdateValueFromComponent(DependencyProperty property)
        {
            if (property == XProperty)
                return X.HasValue && Value.HasValue ? (Int4?)new Int4(X.Value, Value.Value.Y, Value.Value.Z, Value.Value.W) : null;
            if (property == YProperty)
                return Y.HasValue && Value.HasValue ? (Int4?)new Int4(Value.Value.X, Y.Value, Value.Value.Z, Value.Value.W) : null;
            if (property == ZProperty)
                return Z.HasValue && Value.HasValue ? (Int4?)new Int4(Value.Value.X, Value.Value.Y, Z.Value, Value.Value.W) : null;
            if (property == WProperty)
                return W.HasValue && Value.HasValue ? (Int4?)new Int4(Value.Value.X, Value.Value.Y, Value.Value.Z, W.Value) : null;

            throw new ArgumentException("Property unsupported by method UpdateValueFromComponent.");
        }

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

View on GitHub (pinned to 96fad776d2)