{"record":{"id":"e4c5358e78538caf","repo":"stride3d/stride","slug":"property-unsupported-by-method-onhsvvaluechanged","errorCode":null,"errorMessage":"Property unsupported by method OnHSVValueChanged.","messagePattern":"Property unsupported by method OnHSVValueChanged\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/presentation/Stride.Core.Presentation.Wpf/Controls/ColorPicker.cs","lineNumber":487,"sourceCode":"        private void OnHSVValueChanged(DependencyPropertyChangedEventArgs e)\n        {\n            bool isInitializing = !templateApplied && initializingProperty == null;\n            if (isInitializing)\n                initializingProperty = e.Property;\n            \n            if (!interlock)\n            {\n                if (e.Property == HueProperty)\n                {\n                    InternalColor = new ColorHSV((float)e.NewValue, Saturation / 100.0f, Brightness / 100.0f, Alpha / 255.0f);\n                    RenderColorPickerSurface();\n                }\n                else if (e.Property == SaturationProperty)\n                    InternalColor = new ColorHSV(Hue, (float)e.NewValue / 100.0f, Brightness / 100.0f, Alpha / 255.0f);\n                else if (e.Property == BrightnessProperty)\n                    InternalColor = new ColorHSV(Hue, Saturation / 100.0f, (float)e.NewValue / 100.0f, Alpha / 255.0f);\n                else\n                    throw new ArgumentException(\"Property unsupported by method OnHSVValueChanged.\");\n\n                var colorRGBA = InternalColor.ToColor();\n                interlock = true;\n                SetCurrentValue(RedProperty, (byte)(Math.Round(colorRGBA.R * 255.0f)));\n                SetCurrentValue(GreenProperty, (byte)(Math.Round(colorRGBA.G * 255.0f)));\n                SetCurrentValue(BlueProperty, (byte)(Math.Round(colorRGBA.B * 255.0f)));\n                SetCurrentValue(AlphaProperty, (byte)(Math.Round(colorRGBA.A * 255.0f)));\n                interlock = false;\n            }\n\n            UpdateBinding(e.Property);\n\n            if (colorPickerSelector != null && colorPickerRenderSurface != null && !suspendBindingUpdates)\n            {\n                Canvas.SetLeft(colorPickerSelector, Saturation * colorPickerRenderSurface.Width / 100.0);\n                Canvas.SetTop(colorPickerSelector, Brightness * colorPickerRenderSurface.Height / 100.0);\n            }\n            if (huePickerSelector != null && huePickerRenderSurface != null && !suspendBindingUpdates)","sourceCodeStart":469,"sourceCodeEnd":505,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/presentation/Stride.Core.Presentation.Wpf/Controls/ColorPicker.cs#L469-L505","documentation":"ColorPicker.OnHSVValueChanged handles changes to the HSV-side dependency properties (Hue, Saturation, Brightness) and rebuilds InternalColor before syncing back the RGBA values. Any other property routed here triggers the fall-through ArgumentException, signaling an internal dispatch inconsistency.","triggerScenarios":"The HSV property-changed callback invoked with a DependencyProperty other than HueProperty/SaturationProperty/BrightnessProperty — e.g. after adding a new HSV-related property routed to the same handler or manually invoking the callback.","commonSituations":"Customizing/deriving ColorPicker; refactoring property registration so AlphaProperty is accidentally routed to the HSV handler; library upgrade regressions.","solutions":["Register this callback only on Hue/Saturation/Brightness properties.","If a new HSV-side property was added, add a branch for it before the throw.","If unmodified, check the Stride version for known regressions and update."],"exampleFix":"// before\nelse if (e.Property == BrightnessProperty)\n    InternalColor = new ColorHSV(Hue, Saturation/100f, (float)e.NewValue/100f, Alpha/255f);\nelse\n    throw new ArgumentException(\"Property unsupported by method OnHSVValueChanged.\");\n// after\nelse if (e.Property == BrightnessProperty)\n    InternalColor = new ColorHSV(Hue, Saturation/100f, (float)e.NewValue/100f, Alpha/255f);\nelse if (e.Property == NewHsvProperty)\n    InternalColor = ComputeNewHsv((float)e.NewValue);\nelse\n    throw new ArgumentException(\"Property unsupported by method OnHSVValueChanged.\");","handlingStrategy":"try-catch","validationCode":"bool isHsv = prop == ColorPicker.HueProperty || prop == ColorPicker.SaturationProperty || prop == ColorPicker.BrightnessProperty;","typeGuard":null,"tryCatchPattern":"try { OnHSVValueChanged(sender, e); }\ncatch (ArgumentException ex) { log.Error(\"ColorPicker HSV callback got unexpected property\", ex); }","preventionTips":["Register this callback only on Hue, Saturation, and Brightness.","Keep RGBA properties routed to OnRGBAValueChanged, HSV ones to OnHSVValueChanged.","Add regression tests for both callback chains after subclass changes."],"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"}