{"record":{"id":"edc116a2337beb45","repo":"git-ecosystem/git-credential-manager","slug":"argument-must-be-strictly-greater-than-lower","errorCode":null,"errorMessage":"Argument must be strictly greater than {lower}.","messagePattern":"Argument must be strictly greater than (.+?)\\.","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"src/Core/EnsureArgument.cs","lineNumber":86,"sourceCode":"\n        public static void Negative(int arg, string name)\n        {\n            if (arg >= 0)\n            {\n                throw new ArgumentOutOfRangeException(name, \"Argument must be negative.\");\n            }\n        }\n\n        public static void InRange(int arg, string name, int lower, int upper, bool lowerInclusive = true, bool upperInclusive = true)\n        {\n            if (lowerInclusive && arg < lower)\n            {\n                throw new ArgumentOutOfRangeException(name, $\"Argument must be greater than or equal to {lower}.\");\n            }\n\n            if (!lowerInclusive && arg <= lower)\n            {\n                throw new ArgumentOutOfRangeException(name, $\"Argument must be strictly greater than {lower}.\");\n            }\n\n            if (upperInclusive && arg > upper)\n            {\n                throw new ArgumentOutOfRangeException(name, $\"Argument must be less than or equal to {upper}.\");\n            }\n\n            if (!upperInclusive && arg >= upper)\n            {\n                throw new ArgumentOutOfRangeException(name, $\"Argument must be strictly less than {upper}.\");\n            }\n        }\n    }\n}\n","sourceCodeStart":68,"sourceCodeEnd":101,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/Core/EnsureArgument.cs#L68-L101","documentation":"This ArgumentOutOfRangeException is thrown by EnsureArgument.InRange when lowerInclusive is false and the argument is less than or equal to the lower bound. With an exclusive lower bound the value must satisfy arg > lower strictly. The message interpolates the actual bound.","triggerScenarios":"Calling EnsureArgument.InRange(arg, name, lower, upper, lowerInclusive: false) with arg <= lower, e.g., passing exactly the exclusive minimum, or forgetting that this overload treats the bound as exclusive.","commonSituations":"Confusion between inclusive and exclusive bound conventions when tightening validation; passing boundary values (arg == lower) that previously passed under the default inclusive behavior; off-by-one after a signature change.","solutions":["Ensure the value is strictly greater than lower; add +1 or clamp to lower + 1 if appropriate","If the bound should be inclusive, pass lowerInclusive: true (the default) or use PositiveOrZero-style checks","Document the exclusive-bound convention where the API is defined","Check recent changes to the call site that switched inclusivity flags"],"exampleFix":"// before\nEnsureArgument.InRange(page, nameof(page), 1, 100, lowerInclusive: false); // page == 1\n// after\nEnsureArgument.InRange(page, nameof(page), 1, 100); // inclusive: page >= 1 is valid","handlingStrategy":"validation","validationCode":"// exclusive lower bound: value must be > lower\nif (value <= lower) value = lower + 1;\nEnsureArgument.InRange(value, nameof(value), lower, upper, lowerInclusive: false);","typeGuard":"static bool IsStrictlyAbove(int v, int lower) => v > lower;","tryCatchPattern":"try { EnsureArgument.InRange(page, nameof(page), 1, 100, lowerInclusive: false); }\ncatch (ArgumentOutOfRangeException ex)\n{\n    throw new InvalidOperationException($\"{ex.ParamName} must be > 1 (exclusive lower bound)\", ex);\n}","preventionTips":["Read the signature carefully: lowerInclusive defaults to true; pass false only intentionally","Clarify inclusive vs exclusive conventions in API docs and tests","Add boundary-value unit tests (lower, lower+1, upper-1, upper)","Prefer the inclusive defaults unless the domain demands exclusivity"],"tags":["argument-validation","range-check","bounds"],"backgroundTag":"value-out-of-range","analyzedSha":"e8ce762cd04b4100ae637b5fbf39ef9d0a96561e","analyzedAt":"2026-09-11T17:15:08.753Z","contentChangedAt":"2026-09-11T17:15:08.753Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}