thebookisclosed/ViVe · error · FeaturePropertyOverflowException
EnabledState must not be higher than 2.
Error message
EnabledState must not be higher than 2.
What it means
EnabledState in RTL_FEATURE_CONFIGURATION is packed into bits 4-5 of CompactState and therefore supports only the defined values 0-2 (Disabled, Enabled, plus the defined RTL_FEATURE_ENABLED_STATE range). Assigning any value above 2 would collide with neighboring packed bits, so the setter throws FeaturePropertyOverflowException("EnabledState", 2).
Solutions
- Mask the raw value: (raw >> 4) & 0x3 before casting to RTL_FEATURE_ENABLED_STATE
- Only assign defined RTL_FEATURE_ENABLED_STATE members (Disabled/Enabled, values 0-2)
- Use RTL_FEATURE_ENABLED_STATE_OPTIONS for 'leave unchanged' semantics instead of out-of-range sentinel values
Example fix
// before config.EnabledState = (RTL_FEATURE_ENABLED_STATE)rawDword; // after config.EnabledState = (RTL_FEATURE_ENABLED_STATE)((rawDword >> 4) & 0x3);
Defensive patterns
Strategy: validation
Validate before calling
uint v = (uint)rawEnabledState; if (v > 2) throw new ArgumentOutOfRangeException(nameof(rawEnabledState), "EnabledState must be 0-2."); config.EnabledState = (RTL_FEATURE_ENABLED_STATE)v;
Type guard
static bool IsValidEnabledState(uint v) => v <= 2;
Try / catch
try { config.EnabledState = value; }
catch (FeaturePropertyOverflowException ex)
{
// fall back to EnabledState.Disabled or surface a decode error
} Prevention
- Mask decoded values: (raw >> 4) & 0x3
- Use EnabledStateOptions/Update fields for 'unchanged' semantics, not sentinel numbers
- Only assign RTL_FEATURE_ENABLED_STATE.Disabled or .Enabled
When it happens
Trigger: Assigning an out-of-range cast value to config.EnabledState, e.g. config.EnabledState = (RTL_FEATURE_ENABLED_STATE)rawValue where rawValue > 2.
Common situations: Decoding packed native data without masking bits 4-5; treating EnabledStateOptions bit flags as an EnabledState value; reading garbage from an unvalidated registry blob.
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
- Priority must not be higher than 15.
- VariantPayloadKind must not be higher than 3.
- EnabledStateOptions must not be higher than 1.
- Variant must not be higher than 63.
- Operation must not be higher than 4.
AI-assisted analysis of thebookisclosed/ViVe@3f8c6a3425 (2026-09-14).
Data as JSON: /api/errors/ae64ea6317347421.
Report an issue: GitHub.
Appendix: source
Thrown at ViVe/NativeStructs.cs:63
}
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);
}
}
public bool IsWexpConfiguration
{
get
{
return ((CompactState & 0x40) >> 6) == 1;
}
set
{
CompactState = (CompactState & 0xFFFFFFBF) | ((value ? (uint)1 : 0) << 6);
}
}
public bool HasSubscriptions
{View on GitHub (pinned to 3f8c6a3425)