stride3d/stride · error · ArgumentException

Property unsupported by method OnRGBAValueChanged.

Error message

Property unsupported by method OnRGBAValueChanged.

What it means

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.

Solutions

  1. Add an explicit branch for the newly added property in OnRGBAValueChanged.
  2. Ensure only the four RGBA properties are registered with this PropertyChangedCallback.
  3. If unmodified, report/verify against the Stride version; avoid subclassing that re-routes this handler.

Example fix

// before
else if (e.Property == AlphaProperty)
    colorRGBA = new Color4(Red/255f, Green/255f, Blue/255f, (byte)e.NewValue/255f);
else
    throw new ArgumentException("Property unsupported by method OnRGBAValueChanged.");
// after
else if (e.Property == AlphaProperty)
    colorRGBA = new Color4(Red/255f, Green/255f, Blue/255f, (byte)e.NewValue/255f);
else if (e.Property == NewChannelProperty)
    colorRGBA = ComputeWithNewChannel((byte)e.NewValue);
else
    throw new ArgumentException("Property unsupported by method OnRGBAValueChanged.");
Defensive patterns

Strategy: try-catch

Validate before calling

bool isRgba = prop == ColorPicker.RedProperty || prop == ColorPicker.GreenProperty || prop == ColorPicker.BlueProperty || prop == ColorPicker.AlphaProperty;

Try / catch

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

Prevention

When it happens

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

Common situations: Extending ColorPicker with additional channels; internal bug after library upgrade; subclass overriding property metadata reusing this handler.

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/56c83a62f2cf4894. Report an issue: GitHub.

Appendix: source

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

        private void OnRGBAValueChanged(DependencyPropertyChangedEventArgs e)
        {
            bool isInitializing = !templateApplied && initializingProperty == null;
            if (isInitializing)
                initializingProperty = e.Property;

            if (!interlock)
            {
                Color4 colorRGBA;
                if (e.Property == RedProperty)
                    colorRGBA = new Color4((byte)e.NewValue / 255.0f, Green / 255.0f, Blue / 255.0f, Alpha / 255.0f);
                else if (e.Property == GreenProperty)
                    colorRGBA = new Color4(Red / 255.0f, (byte)e.NewValue / 255.0f, Blue / 255.0f, Alpha / 255.0f);
                else if (e.Property == BlueProperty)
                    colorRGBA = new Color4(Red / 255.0f, Green / 255.0f, (byte)e.NewValue / 255.0f, Alpha / 255.0f);
                else if (e.Property == AlphaProperty)
                    colorRGBA = new Color4(Red / 255.0f, Green / 255.0f, Blue / 255.0f, (byte)e.NewValue / 255.0f);
                else
                    throw new ArgumentException("Property unsupported by method OnRGBAValueChanged.");

                interlock = true;
                InternalColor = ColorHSV.FromColor(colorRGBA);
                SetCurrentValue(HueProperty, InternalColor.H);
                SetCurrentValue(SaturationProperty, InternalColor.S * 100.0f);
                SetCurrentValue(BrightnessProperty, InternalColor.V * 100.0f);
                interlock = false;
            }
            
            UpdateBinding(e.Property);
            if (isInitializing)
                initializingProperty = null;
        }

        /// <summary>
        /// Raised when the <see cref="Hue"/>, <see cref="Saturation"/>, or <see cref="Brightness"/> properties are modified.
        /// </summary>
        /// <param name="e">The dependency property that has changed.</param>

View on GitHub (pinned to 96fad776d2)