{"record":{"id":"8f62a77531e5a43e","repo":"abpframework/abp","slug":"parametername-is-equal-to-zero","errorCode":null,"errorMessage":"{parameterName} is equal to zero","messagePattern":"(.+?) is equal to zero","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Core/Volo/Abp/Check.cs","lineNumber":174,"sourceCode":"                throw new ArgumentException($\"{parameterName} length must be equal to or bigger than {minLength}!\", parameterName);\n            }\n        }\n\n        if (value != null && value.Length > maxLength)\n        {\n            throw new ArgumentException($\"{parameterName} length must be equal to or lower than {maxLength}!\", parameterName);\n        }\n\n        return value;\n    }\n\n    public static Int16 Positive(\n        Int16 value,\n        [InvokerParameterName][NotNull] string parameterName)\n    {\n        if (value == 0)\n        {\n            throw new ArgumentException($\"{parameterName} is equal to zero\");\n        }\n        else if (value < 0)\n        {\n            throw new ArgumentException($\"{parameterName} is less than zero\");\n        }\n        return value;\n    }\n\n    public static Int32 Positive(\n        Int32 value,\n        [InvokerParameterName][NotNull] string parameterName)\n    {\n        if (value == 0)\n        {\n            throw new ArgumentException($\"{parameterName} is equal to zero\");\n        }\n        else if (value < 0)\n        {","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs#L156-L192","documentation":"Thrown by Check.Positive(Int16 value, string) when value == 0. 'Positive' in ABP strictly means greater than zero, so zero is rejected. It is an ArgumentException (not ArgumentOutOfRangeException) naming the parameter.","triggerScenarios":"Calling Check.Positive((short)count, nameof(count)) when count is 0. Used to guard quantities, counts, sequence numbers, and other signed 16-bit fields that must be at least 1.","commonSituations":"A paging/skip-take where page is 0; a quantity or priority field left at its default of 0; parsing user input that yielded 0 for an Id; an enum/flag cast to Int16 landing on 0.","solutions":["Pass a strictly positive Int16 (>= 1) for the argument.","If zero is semantically valid, replace Check.Positive with a custom range/nullable guard or Check.Range(value, name, 0).","Default the field to 1 (or another positive seed) at construction instead of leaving it 0.","Validate input upstream (e.g. [Range(1, short.MaxValue)]) so the error surfaces as a validation message."],"exampleFix":"// before\nCheck.Positive((short)pageNumber, nameof(pageNumber)); // pageNumber == 0 -> throws\n\n// after\nvar page = (short)Math.Max(1, pageNumber);\nCheck.Positive(page, nameof(page));","handlingStrategy":"validation","validationCode":"// Ensure strictly positive Int16 before guarding\nshort safe = value > 0 ? value : (short)1;\nCheck.Positive(safe, nameof(value));","typeGuard":"static bool IsPositiveShort(short v) => v > 0;","tryCatchPattern":null,"preventionTips":["Remember ABP 'Positive' means > 0; zero is rejected. Use Check.Range(v, name, 0) if zero is valid.","Default Int16 fields to 1 (not 0) when they must be positive.","Add [Range(1, short.MaxValue)] on DTOs for positive 16-bit fields."],"tags":["argument-validation","numeric","int16","abp","guard-clause"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}