{"record":{"id":"02306954f906a544","repo":"stride3d/stride","slug":"property-unsupported-by-method-updatevaluefromcomponent-023069","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/Int2Editor.cs","lineNumber":50,"sourceCode":"        /// <inheritdoc/>\n        protected override void UpdateComponentsFromValue(Int2? value)\n        {\n            if (value != null)\n            {\n                SetCurrentValue(XProperty, value.Value.X);\n                SetCurrentValue(YProperty, value.Value.Y);\n            }\n        }\n\n        /// <inheritdoc/>\n        protected override Int2? UpdateValueFromComponent(DependencyProperty property)\n        {\n            if (property == XProperty)\n                return X.HasValue && Value.HasValue ? (Int2?)new Int2(X.Value, Value.Value.Y) : null;\n            if (property == YProperty)\n                return Y.HasValue && Value.HasValue ? (Int2?)new Int2(Value.Value.X, Y.Value) : null;\n              \n            throw new ArgumentException(\"Property unsupported by method UpdateValueFromComponent.\");\n        }\n\n        /// <inheritdoc/>\n        protected override Int2? UpdateValueFromFloat(float value)\n        {\n            return new Int2((int)Math.Round(value, MidpointRounding.AwayFromZero));\n        }\n    }\n}\n","sourceCodeStart":32,"sourceCodeEnd":60,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/presentation/Stride.Core.Presentation.Wpf/Controls/Int2Editor.cs#L32-L60","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure only XProperty and YProperty are routed into UpdateValueFromComponent","If a new component DependencyProperty was added (e.g. a Z), extend the if-chain to handle it before the throw","Override UpdateValueFromComponent in a subclass and handle your custom properties instead of calling the base implementation","Check the call stack to identify which DependencyProperty change was mis-routed"],"exampleFix":"// before\nif (property == YProperty)\n    return Y.HasValue && Value.HasValue ? (Int2?)new Int2(Value.Value.X, Y.Value) : null;\nthrow new ArgumentException(\"Property unsupported by method UpdateValueFromComponent.\");\n// after\nif (property == YProperty)\n    return Y.HasValue && Value.HasValue ? (Int2?)new Int2(Value.Value.X, Y.Value) : null;\nif (property == MyExtraProperty) // handle any newly added component property\n    return ComputeFromExtra();\nthrow new ArgumentException($\"Property unsupported by method UpdateValueFromComponent: {property.Name}\");","handlingStrategy":"validation","validationCode":"// before routing a property change\nbool isKnownComponent = property == Int2Editor.XProperty || property == Int2Editor.YProperty;\nif (!isKnownComponent) throw new InvalidOperationException($\"{property.Name} is not an Int2 component property\");","typeGuard":"bool IsInt2ComponentProperty(DependencyProperty p) => p == Int2Editor.XProperty || p == Int2Editor.YProperty;","tryCatchPattern":"try { editor.UpdateValueFromComponent(prop); }\ncatch (ArgumentException ex) { log.Warn($\"Unsupported property for Int2Editor: {ex.Message}\"); }","preventionTips":["Keep the if-chain and registered DPs in sync when adding component properties","Override UpdateValueFromComponent for subclasses with extra DPs","Include property.Name in the exception message for diagnosability"],"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"}