stride3d/stride · error · ArgumentException

Property unsupported by method UpdateValueFromComponent.

Error message

Property unsupported by method UpdateValueFromComponent.

What it means

Int3Editor.UpdateValueFromComponent rebuilds an Int3 from whichever of XProperty/YProperty/ZProperty changed. Receiving any other DependencyProperty means the caller violated the editor's contract, so ArgumentException is thrown instead of producing a partial or wrong Int3.

Solutions

  1. Route only XProperty, YProperty, and ZProperty through UpdateValueFromComponent
  2. Extend the if-chain when adding new component properties to a subclass
  3. Override UpdateValueFromComponent in the subclass to handle custom properties
  4. Log or inspect property.Name at the throw site to find the mis-routed dependency property

Example fix

// before
if (property == ZProperty)
    return Z.HasValue && Value.HasValue ? (Int3?)new Int3(Value.Value.X, Value.Value.Y, Z.Value) : null;
throw new ArgumentException("Property unsupported by method UpdateValueFromComponent.");
// after
if (property == ZProperty)
    return Z.HasValue && Value.HasValue ? (Int3?)new Int3(Value.Value.X, Value.Value.Y, Z.Value) : null;
Debug.Assert(false, $"Unexpected property {property.Name} in UpdateValueFromComponent");
return Value; // or handle explicitly before throwing
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

bool IsInt3ComponentProperty(DependencyProperty p) => p == Int3Editor.XProperty || p == Int3Editor.YProperty || p == Int3Editor.ZProperty;

Try / catch

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

Prevention

When it happens

Trigger: Invoking UpdateValueFromComponent with a DependencyProperty not in {XProperty, YProperty, ZProperty}, typically from subclass code or mis-wired property-change callbacks.

Common situations: Adding a new DependencyProperty to a custom Int3 editor without extending the mapping chain; copy-pasted property-changed handlers forwarding the wrong DP; base/editor-framework code assuming only vector-component properties change.

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/5b9a08b23907e5e7. Report an issue: GitHub.

Appendix: source

Thrown at sources/presentation/Stride.Core.Presentation.Wpf/Controls/Int3Editor.cs:63

            if (value != null)
            {
                SetCurrentValue(XProperty, value.Value.X);
                SetCurrentValue(YProperty, value.Value.Y);
                SetCurrentValue(ZProperty, value.Value.Z);
            }
        }

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

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

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

View on GitHub (pinned to 96fad776d2)