{"record":{"id":"56c83a62f2cf4894","repo":"stride3d/stride","slug":"property-unsupported-by-method-onrgbavaluechanged","errorCode":null,"errorMessage":"Property unsupported by method OnRGBAValueChanged.","messagePattern":"Property unsupported by method OnRGBAValueChanged\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/presentation/Stride.Core.Presentation.Wpf/Controls/ColorPicker.cs","lineNumber":450,"sourceCode":"        private void OnRGBAValueChanged(DependencyPropertyChangedEventArgs e)\n        {\n            bool isInitializing = !templateApplied && initializingProperty == null;\n            if (isInitializing)\n                initializingProperty = e.Property;\n\n            if (!interlock)\n            {\n                Color4 colorRGBA;\n                if (e.Property == RedProperty)\n                    colorRGBA = new Color4((byte)e.NewValue / 255.0f, Green / 255.0f, Blue / 255.0f, Alpha / 255.0f);\n                else if (e.Property == GreenProperty)\n                    colorRGBA = new Color4(Red / 255.0f, (byte)e.NewValue / 255.0f, Blue / 255.0f, Alpha / 255.0f);\n                else if (e.Property == BlueProperty)\n                    colorRGBA = new Color4(Red / 255.0f, Green / 255.0f, (byte)e.NewValue / 255.0f, Alpha / 255.0f);\n                else if (e.Property == AlphaProperty)\n                    colorRGBA = new Color4(Red / 255.0f, Green / 255.0f, Blue / 255.0f, (byte)e.NewValue / 255.0f);\n                else\n                    throw new ArgumentException(\"Property unsupported by method OnRGBAValueChanged.\");\n\n                interlock = true;\n                InternalColor = ColorHSV.FromColor(colorRGBA);\n                SetCurrentValue(HueProperty, InternalColor.H);\n                SetCurrentValue(SaturationProperty, InternalColor.S * 100.0f);\n                SetCurrentValue(BrightnessProperty, InternalColor.V * 100.0f);\n                interlock = false;\n            }\n            \n            UpdateBinding(e.Property);\n            if (isInitializing)\n                initializingProperty = null;\n        }\n\n        /// <summary>\n        /// Raised when the <see cref=\"Hue\"/>, <see cref=\"Saturation\"/>, or <see cref=\"Brightness\"/> properties are modified.\n        /// </summary>\n        /// <param name=\"e\">The dependency property that has changed.</param>","sourceCodeStart":432,"sourceCodeEnd":468,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/presentation/Stride.Core.Presentation.Wpf/Controls/ColorPicker.cs#L432-L468","documentation":"ColorPicker.OnRGBAValueChanged is a property-change callback that reconstructs the color from whichever RGBA dependency property changed (Red, Green, Blue, Alpha). If e.Property matches none of them, it throws ArgumentException — an internal invariant indicating the callback was invoked for an unregistered property.","triggerScenarios":"The RGBA property-changed handler receiving a DependencyProperty other than RedProperty/GreenProperty/BlueProperty/AlphaProperty — only possible if new RGBA-side properties were added and routed to this handler, or via reflection/manual callback invocation.","commonSituations":"Extending ColorPicker with additional channels; internal bug after library upgrade; subclass overriding property metadata reusing this handler.","solutions":["Add an explicit branch for the newly added property in OnRGBAValueChanged.","Ensure only the four RGBA properties are registered with this PropertyChangedCallback.","If unmodified, report/verify against the Stride version; avoid subclassing that re-routes this handler."],"exampleFix":"// before\nelse if (e.Property == AlphaProperty)\n    colorRGBA = new Color4(Red/255f, Green/255f, Blue/255f, (byte)e.NewValue/255f);\nelse\n    throw new ArgumentException(\"Property unsupported by method OnRGBAValueChanged.\");\n// after\nelse if (e.Property == AlphaProperty)\n    colorRGBA = new Color4(Red/255f, Green/255f, Blue/255f, (byte)e.NewValue/255f);\nelse if (e.Property == NewChannelProperty)\n    colorRGBA = ComputeWithNewChannel((byte)e.NewValue);\nelse\n    throw new ArgumentException(\"Property unsupported by method OnRGBAValueChanged.\");","handlingStrategy":"try-catch","validationCode":"bool isRgba = prop == ColorPicker.RedProperty || prop == ColorPicker.GreenProperty || prop == ColorPicker.BlueProperty || prop == ColorPicker.AlphaProperty;","typeGuard":null,"tryCatchPattern":"try { OnRGBAValueChanged(sender, e); }\ncatch (ArgumentException ex) { log.Error(\"ColorPicker RGBA callback got unexpected property\", ex); }","preventionTips":["Register this PropertyChangedCallback only on the four RGBA properties.","When adding channels to a derived picker, extend the branch chain, not the routing.","Write a test toggling each RGBA property after any ColorPicker customization."],"tags":["wpf","internal-invariant","property-dispatch"],"backgroundTag":"internal-invariant-violation","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}