stride3d/stride · error · ArgumentException

Property unsupported by method OnHSVValueChanged.

Error message

Property unsupported by method OnHSVValueChanged.

What it means

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.

Solutions

  1. Register this callback only on Hue/Saturation/Brightness properties.
  2. If a new HSV-side property was added, add a branch for it before the throw.
  3. If unmodified, check the Stride version for known regressions and update.

Example fix

// before
else if (e.Property == BrightnessProperty)
    InternalColor = new ColorHSV(Hue, Saturation/100f, (float)e.NewValue/100f, Alpha/255f);
else
    throw new ArgumentException("Property unsupported by method OnHSVValueChanged.");
// after
else if (e.Property == BrightnessProperty)
    InternalColor = new ColorHSV(Hue, Saturation/100f, (float)e.NewValue/100f, Alpha/255f);
else if (e.Property == NewHsvProperty)
    InternalColor = ComputeNewHsv((float)e.NewValue);
else
    throw new ArgumentException("Property unsupported by method OnHSVValueChanged.");
Defensive patterns

Strategy: try-catch

Validate before calling

bool isHsv = prop == ColorPicker.HueProperty || prop == ColorPicker.SaturationProperty || prop == ColorPicker.BrightnessProperty;

Try / catch

try { OnHSVValueChanged(sender, e); }
catch (ArgumentException ex) { log.Error("ColorPicker HSV callback got unexpected property", ex); }

Prevention

When it happens

Trigger: 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.

Common situations: Customizing/deriving ColorPicker; refactoring property registration so AlphaProperty is accidentally routed to the HSV handler; library upgrade regressions.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/e4c5358e78538caf. Report an issue: GitHub.

Appendix: source

Thrown at sources/presentation/Stride.Core.Presentation.Wpf/Controls/ColorPicker.cs:487

        private void OnHSVValueChanged(DependencyPropertyChangedEventArgs e)
        {
            bool isInitializing = !templateApplied && initializingProperty == null;
            if (isInitializing)
                initializingProperty = e.Property;
            
            if (!interlock)
            {
                if (e.Property == HueProperty)
                {
                    InternalColor = new ColorHSV((float)e.NewValue, Saturation / 100.0f, Brightness / 100.0f, Alpha / 255.0f);
                    RenderColorPickerSurface();
                }
                else if (e.Property == SaturationProperty)
                    InternalColor = new ColorHSV(Hue, (float)e.NewValue / 100.0f, Brightness / 100.0f, Alpha / 255.0f);
                else if (e.Property == BrightnessProperty)
                    InternalColor = new ColorHSV(Hue, Saturation / 100.0f, (float)e.NewValue / 100.0f, Alpha / 255.0f);
                else
                    throw new ArgumentException("Property unsupported by method OnHSVValueChanged.");

                var colorRGBA = InternalColor.ToColor();
                interlock = true;
                SetCurrentValue(RedProperty, (byte)(Math.Round(colorRGBA.R * 255.0f)));
                SetCurrentValue(GreenProperty, (byte)(Math.Round(colorRGBA.G * 255.0f)));
                SetCurrentValue(BlueProperty, (byte)(Math.Round(colorRGBA.B * 255.0f)));
                SetCurrentValue(AlphaProperty, (byte)(Math.Round(colorRGBA.A * 255.0f)));
                interlock = false;
            }

            UpdateBinding(e.Property);

            if (colorPickerSelector != null && colorPickerRenderSurface != null && !suspendBindingUpdates)
            {
                Canvas.SetLeft(colorPickerSelector, Saturation * colorPickerRenderSurface.Width / 100.0);
                Canvas.SetTop(colorPickerSelector, Brightness * colorPickerRenderSurface.Height / 100.0);
            }
            if (huePickerSelector != null && huePickerRenderSurface != null && !suspendBindingUpdates)

View on GitHub (pinned to 96fad776d2)