thebookisclosed/ViVe · error · FeaturePropertyOverflowException

EnabledStateOptions must not be higher than 1.

Error message

EnabledStateOptions must not be higher than 1.

What it means

EnabledStateOptions in RTL_FEATURE_CONFIGURATION_UPDATE is a 1-bit option (valid values 0-1) that tells the native API whether to set or skip the EnabledState. Any value above 1 is invalid, so the setter throws FeaturePropertyOverflowException("EnabledStateOptions", 1).

Solutions

  1. Mask the value with & 0x1 before casting to RTL_FEATURE_ENABLED_STATE_OPTIONS
  2. Assign only the defined enum members (e.g. DontSet / Set) instead of computed flag combinations
  3. If you need to express several options, they belong in different fields, not combined into this 1-bit property

Example fix

// before
update.EnabledStateOptions = (RTL_FEATURE_ENABLED_STATE_OPTIONS)(flagsA | flagsB); // may exceed 1
// after
update.EnabledStateOptions = ((uint)flagsA | flagsB) != 0 ? RTL_FEATURE_ENABLED_STATE_OPTIONS.Set : RTL_FEATURE_ENABLED_STATE_OPTIONS.DontSet;
Defensive patterns

Strategy: validation

Validate before calling

uint o = (uint)options;
if (o > 1) throw new ArgumentOutOfRangeException(nameof(options), "EnabledStateOptions must be 0-1.");
update.EnabledStateOptions = (RTL_FEATURE_ENABLED_STATE_OPTIONS)o;

Type guard

static bool IsValidEnabledStateOptions(uint v) => v <= 1;

Try / catch

try { update.EnabledStateOptions = options; }
catch (FeaturePropertyOverflowException ex)
{
    // reduce to a single-bit decision: set or don't set
}

Prevention

When it happens

Trigger: Assigning update.EnabledStateOptions = (RTL_FEATURE_ENABLED_STATE_OPTIONS)value with value > 1, e.g. casting a multi-bit flags word into the property.

Common situations: OR-ing multiple flags together and assigning the combined word; copying an options field from a different struct/ABI with wider options; decoding raw memory without masking to one bit.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


AI-assisted analysis of thebookisclosed/ViVe@3f8c6a3425 (2026-09-14). Data as JSON: /api/errors/8665ecb5712ef728. Report an issue: GitHub.

Appendix: source

Thrown at ViVe/NativeStructs.cs:179

            }
            set
            {
                if ((uint)value > 2)
                    throw new FeaturePropertyOverflowException("EnabledState", 2);
                _enabledState = value;
            }
        }

        public RTL_FEATURE_ENABLED_STATE_OPTIONS EnabledStateOptions
        {
            get
            {
                return _enabledStateOptions;
            }
            set
            {
                if ((uint)value > 1)
                    throw new FeaturePropertyOverflowException("EnabledStateOptions", 1);
                _enabledStateOptions = value;
            }
        }

        public uint Variant
        {
            get
            {
                return _variant;
            }
            set
            {
                if (value > 63)
                    throw new FeaturePropertyOverflowException("Variant", 63);
                _variant = value;
            }
        }

View on GitHub (pinned to 3f8c6a3425)