{"record":{"id":"dcbd324afcbfdbb3","repo":"stride3d/stride","slug":"property-unsupported-by-method-updatevaluefromcomponent-dcbd32","errorCode":null,"errorMessage":"Property unsupported by method UpdateValueFromComponent.","messagePattern":"Property unsupported by method UpdateValueFromComponent\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/presentation/Stride.Core.Presentation.Wpf/Controls/Int4Editor.cs","lineNumber":76,"sourceCode":"                SetCurrentValue(YProperty, value.Value.Y);\n                SetCurrentValue(ZProperty, value.Value.Z);\n                SetCurrentValue(WProperty, value.Value.W);\n            }\n        }\n\n        /// <inheritdoc/>\n        protected override Int4? UpdateValueFromComponent(DependencyProperty property)\n        {\n            if (property == XProperty)\n                return X.HasValue && Value.HasValue ? (Int4?)new Int4(X.Value, Value.Value.Y, Value.Value.Z, Value.Value.W) : null;\n            if (property == YProperty)\n                return Y.HasValue && Value.HasValue ? (Int4?)new Int4(Value.Value.X, Y.Value, Value.Value.Z, Value.Value.W) : null;\n            if (property == ZProperty)\n                return Z.HasValue && Value.HasValue ? (Int4?)new Int4(Value.Value.X, Value.Value.Y, Z.Value, Value.Value.W) : null;\n            if (property == WProperty)\n                return W.HasValue && Value.HasValue ? (Int4?)new Int4(Value.Value.X, Value.Value.Y, Value.Value.Z, W.Value) : null;\n\n            throw new ArgumentException(\"Property unsupported by method UpdateValueFromComponent.\");\n        }\n\n        /// <inheritdoc/>\n        protected override Int4? UpdateValueFromFloat(float value)\n        {\n            return new Int4((int)Math.Round(value, MidpointRounding.AwayFromZero));\n        }\n    }\n}\n","sourceCodeStart":58,"sourceCodeEnd":86,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/presentation/Stride.Core.Presentation.Wpf/Controls/Int4Editor.cs#L58-L86","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Only pass XProperty, YProperty, ZProperty, or WProperty to UpdateValueFromComponent","Extend the mapping chain if a new component DependencyProperty was introduced","Override UpdateValueFromComponent in your subclass for custom properties","Inspect the ArgumentException stack trace to identify the offending property"],"exampleFix":"// before\nif (property == WProperty)\n    return W.HasValue && Value.HasValue ? (Int4?)new Int4(Value.Value.X, Value.Value.Y, Value.Value.Z, W.Value) : null;\nthrow new ArgumentException(\"Property unsupported by method UpdateValueFromComponent.\");\n// after\nif (property == WProperty)\n    return W.HasValue && Value.HasValue ? (Int4?)new Int4(Value.Value.X, Value.Value.Y, Value.Value.Z, W.Value) : null;\nthrow new ArgumentException($\"Property unsupported by method UpdateValueFromComponent: {property?.Name}\"); // clearer diagnostics","handlingStrategy":"validation","validationCode":"bool ok = property == Int4Editor.XProperty || property == Int4Editor.YProperty || property == Int4Editor.ZProperty || property == Int4Editor.WProperty;\nif (!ok) throw new InvalidOperationException($\"{property.Name} is not an Int4 component property\");","typeGuard":"bool IsInt4ComponentProperty(DependencyProperty p) => p == Int4Editor.XProperty || p == Int4Editor.YProperty || p == Int4Editor.ZProperty || p == Int4Editor.WProperty;","tryCatchPattern":"try { editor.UpdateValueFromComponent(prop); }\ncatch (ArgumentException ex) { log.Warn($\"Unsupported property for Int4Editor: {ex.Message}\"); }","preventionTips":["Only forward X/Y/Z/W changes to UpdateValueFromComponent","Update the mapping chain together with any new component DPs","Prefer overriding the method in subclasses over extending base internals"],"tags":["wpf","argumentexception","property-binding"],"backgroundTag":"invalid-argument-value","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}