{"record":{"id":"82f6a4fecea6fd34","repo":"BCUninstaller/Bulk-Crap-Uninstaller","slug":"new-value-must-be-equal-to-or-in-between-the-minim","errorCode":null,"errorMessage":"New value must be equal to or in between the minimum and maximum values","messagePattern":"New value must be equal to or in between the minimum and maximum values","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"source/KlocTools/Limited.cs","lineNumber":39,"sourceCode":"        /// Wrapped value, always equal to any of or in between Minimum and Maximum.\n        /// If ThrowOutOfRange if false and the value is assigned out of this range, it is trimmed.\n        /// Otherwise an exception is thrown.\n        /// </summary>\n        public T Value\n        {\n            get { return _value; }\n            set\n            {\n                _value = GetLimitedValue(value, Minimum, Maximum, ThrowOutOfRange);\n            }\n        }\n\n        private static Tvalue GetLimitedValue<Tvalue>(Tvalue value, Tvalue min, Tvalue max, bool throwOutOfRange)\n            where Tvalue : IComparable<Tvalue>\n        {\n            if (value.CompareTo(max) > 0)\n            {\n                if (throwOutOfRange) throw new ArgumentOutOfRangeException(nameof(value), @\"New value must be equal to or in between the minimum and maximum values\");\n                return max;\n            }\n            else if (value.CompareTo(min) < 0)\n            {\n                if (throwOutOfRange) throw new ArgumentOutOfRangeException(nameof(value), @\"New value must be equal to or in between the minimum and maximum values\");\n                return min;\n            }\n            return value;\n        }\n\n        /// <summary>\n        /// Minimal value of this variable. If set higher than the current value, the current value is trimmed up.\n        /// Must be lower than or equal to the maximal value.\n        /// </summary>\n        public T Minimum\n        {\n            get { return _minimum; }\n            set","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/BCUninstaller/Bulk-Crap-Uninstaller/blob/608321de98e92297377b1eb69029af55c25504a1/source/KlocTools/Limited.cs#L21-L57","documentation":"Limited<T>.Value setter clamps the assigned value into the [Minimum, Maximum] range via GetLimitedValue. When ThrowOutOfRange is true, assigning a value greater than Maximum throws ArgumentOutOfRangeException (this branch) instead of clamping. With the default ThrowOutOfRange=false the value is silently capped to Maximum.","triggerScenarios":"Assigning Value to something above Maximum while ThrowOutOfRange is true; a numeric control bound to a Limited<T> with throw-on-overflow enabled receiving a too-large input.","commonSituations":"UI bindings with throw-on-overflow; computed values that can exceed bounds; lowering Maximum without re-validating the current value.","solutions":["Clamp the value to the range before assigning it.","Set ThrowOutOfRange=false if silent clamping is acceptable.","Raise Maximum (or validate input) so the assigned value fits."],"exampleFix":"// before\nlimited.Value = x;                  // throws if x > Maximum\n// after\nlimited.Value = Math.Min(x, limited.Maximum);","handlingStrategy":"validation","validationCode":"if (x.CompareTo(limited.Maximum) > 0)\n    x = limited.Maximum;\nlimited.Value = x;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clamp inputs to [Minimum, Maximum] before assigning.","Prefer ThrowOutOfRange=false for user-facing inputs where clamping is desired."],"tags":["validation","range","numeric","generic"],"backgroundTag":null,"analyzedSha":"608321de98e92297377b1eb69029af55c25504a1","analyzedAt":"2026-08-13T12:17:35.389Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}