{"record":{"id":"5e1f34e3463f06a0","repo":"thebookisclosed/ViVe","slug":"variant-must-not-be-higher-than-63","errorCode":null,"errorMessage":"Variant must not be higher than 63.","messagePattern":"Variant must not be higher than 63\\.","errorType":"exception","errorClass":"FeaturePropertyOverflowException","httpStatus":null,"severity":"error","filePath":"ViVe/NativeStructs.cs","lineNumber":101,"sourceCode":"            {\n                return ((CompactState & 0x80) >> 7) == 1;\n            }\n            set\n            {\n                CompactState = (CompactState & 0xFFFFFF7F) | ((value ? (uint)1 : 0) << 7);\n            }\n        }\n\n        public uint Variant\n        {\n            get\n            {\n                return (CompactState & 0x3F00) >> 8;\n            }\n            set\n            {\n                if (value > 63)\n                    throw new FeaturePropertyOverflowException(\"Variant\", 63);\n                CompactState = (CompactState & 0xFFFFC0FF) | (value << 8);\n            }\n        }\n\n        public RTL_FEATURE_VARIANT_PAYLOAD_KIND VariantPayloadKind\n        {\n            get\n            {\n                return (RTL_FEATURE_VARIANT_PAYLOAD_KIND)((CompactState & 0xC000) >> 14);\n            }\n            set\n            {\n                if ((uint)value > 3)\n                    throw new FeaturePropertyOverflowException(\"VariantPayloadKind\", 3);\n                CompactState = (CompactState & 0xFFFF3FFF) | ((uint)value << 14);\n            }\n        }\n    }","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/thebookisclosed/ViVe/blob/3f8c6a3425983412da1e8b26cd757c3aa17b3f25/ViVe/NativeStructs.cs#L83-L119","documentation":"Variant in RTL_FEATURE_CONFIGURATION occupies bits 8-13 of CompactState (6 bits), so its maximum value is 63. Assigning a larger value would overwrite VariantPayloadKind bits, so the setter throws FeaturePropertyOverflowException(\"Variant\", 63).","triggerScenarios":"Setting config.Variant to any uint greater than 63, e.g. copying a variant value from an unconstrained source such as a config file or API response.","commonSituations":"Hand-editing variant numbers from documentation or another tool that uses wider variant fields; bulk-applying variant experiments whose IDs exceed the 6-bit Windows feature-variant range.","solutions":["Clamp or validate the variant to 0-63 before assignment","Mask the source value: variant & 0x3F","Verify the variant actually exists for the feature — values above 63 are never valid in this ABI"],"exampleFix":"// before\nconfig.Variant = importedVariant; // may exceed 63\n// after\nconfig.Variant = importedVariant & 0x3F; // or validate: if (importedVariant > 63) throw ...","handlingStrategy":"validation","validationCode":"if (variant > 63) throw new ArgumentOutOfRangeException(nameof(variant), \"Variant must be 0-63.\");\nconfig.Variant = variant;","typeGuard":"static bool IsValidVariant(uint v) => v <= 63;","tryCatchPattern":"try { config.Variant = variant; }\ncatch (FeaturePropertyOverflowException ex)\n{\n    // reject or clamp: ex names Variant with max 63\n}","preventionTips":["Validate external variant inputs against the 0-63 bound","Remember the packed field is 6 bits — nothing larger can round-trip","When importing variants, verify the feature actually defines that variant"],"tags":["csharp","bitfield","value-out-of-range"],"backgroundTag":"value-out-of-range","analyzedSha":"3f8c6a3425983412da1e8b26cd757c3aa17b3f25","analyzedAt":"2026-09-14T11:10:27.021Z","contentChangedAt":"2026-09-14T11:10:27.021Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}