thebookisclosed/ViVe · error · FeaturePropertyOverflowException

Priority must not be higher than 15.

Error message

Priority must not be higher than 15.

What it means

The Priority property of RTL_FEATURE_CONFIGURATION is stored in the low 4 bits of a packed uint (CompactState & 0xF), so it can only hold values 0-15. Assigning anything larger would silently corrupt adjacent packed fields, so the setter throws FeaturePropertyOverflowException (a Feature "Priority" overflow, max 15).

Solutions

  1. Mask the raw value with & 0xF before casting to RTL_FEATURE_CONFIGURATION_PRIORITY
  2. Validate the value is <= 15 before assignment
  3. If the source data legitimately holds a larger number, you are decoding the wrong field or ABI layout

Example fix

// before
config.Priority = (RTL_FEATURE_CONFIGURATION_PRIORITY)rawDword;
// after
config.Priority = (RTL_FEATURE_CONFIGURATION_PRIORITY)(rawDword & 0xF);
Defensive patterns

Strategy: validation

Validate before calling

uint p = (uint)rawPriority;
if (p > 15) throw new ArgumentOutOfRangeException(nameof(rawPriority), "Priority must be 0-15.");
config.Priority = (RTL_FEATURE_CONFIGURATION_PRIORITY)p;

Type guard

static bool IsValidPriority(uint v) => v <= 15;

Try / catch

try { config.Priority = value; }
catch (FeaturePropertyOverflowException ex)
{
    // clamp, mask, or report; ex names the property (Priority) and max (15)
}

Prevention

When it happens

Trigger: Assigning a Priority value greater than 15 (e.g. an arbitrary int/enum cast) to an RTL_FEATURE_CONFIGURATION instance, e.g. config.Priority = (RTL_FEATURE_CONFIGURATION_PRIORITY)someRawValue.

Common situations: Parsing raw registry/native memory into the enum without masking to 4 bits; off-by-shift errors when decoding packed configurations; using an enum value from a different feature-configuration ABI version.

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/9bd364823e9598f7. Report an issue: GitHub.

Appendix: source

Thrown at ViVe/NativeStructs.cs:49

    }

    [StructLayout(LayoutKind.Sequential)]
    public struct RTL_FEATURE_CONFIGURATION
    {
        public uint FeatureId;
        public uint CompactState;
        public uint VariantPayload;

        public RTL_FEATURE_CONFIGURATION_PRIORITY Priority
        {
            get
            {
                return (RTL_FEATURE_CONFIGURATION_PRIORITY)(CompactState & 0xF);
            }
            set
            {
                if ((uint)value > 15)
                    throw new FeaturePropertyOverflowException("Priority", 15);
                CompactState = (CompactState & 0xFFFFFFF0) | (uint)value;
            }
        }

        public RTL_FEATURE_ENABLED_STATE EnabledState
        {
            get
            {
                return (RTL_FEATURE_ENABLED_STATE)((CompactState & 0x30) >> 4);
            }
            set
            {
                if ((uint)value > 2)
                    throw new FeaturePropertyOverflowException("EnabledState", 2);
                CompactState = (CompactState & 0xFFFFFFCF) | ((uint)value << 4);
            }
        }

View on GitHub (pinned to 3f8c6a3425)