{"record":{"id":"806e4e5d27239500","repo":"abpframework/abp","slug":"parametername-length-must-be-equal-to-or-lower-t","errorCode":null,"errorMessage":"{parameterName} length must be equal to or lower than {maxLength}!","messagePattern":"(.+?) length must be equal to or lower than (.+?)!","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Core/Volo/Abp/Check.cs","lineNumber":52,"sourceCode":"\n        return value;\n    }\n\n    [ContractAnnotation(\"value:null => halt\")]\n    public static string NotNull(\n        [System.Diagnostics.CodeAnalysis.NotNull] string? value,\n        [InvokerParameterName][NotNull] string parameterName,\n        int maxLength = int.MaxValue,\n        int minLength = 0)\n    {\n        if (value == null)\n        {\n            throw new ArgumentException($\"{parameterName} can not be null!\", parameterName);\n        }\n\n        if (value.Length > maxLength)\n        {\n            throw new ArgumentException($\"{parameterName} length must be equal to or lower than {maxLength}!\", parameterName);\n        }\n\n        if (minLength > 0 && value.Length < minLength)\n        {\n            throw new ArgumentException($\"{parameterName} length must be equal to or bigger than {minLength}!\", parameterName);\n        }\n\n        return value;\n    }\n\n    [ContractAnnotation(\"value:null => halt\")]\n    public static string NotNullOrWhiteSpace(\n        [System.Diagnostics.CodeAnalysis.NotNull] string? value,\n        [InvokerParameterName][NotNull] string parameterName,\n        int maxLength = int.MaxValue,\n        int minLength = 0)\n    {\n        if (value.IsNullOrWhiteSpace())","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs#L34-L70","documentation":"The maxLength branch of Check.NotNull(string) fires when value.Length exceeds the optional maxLength (default int.MaxValue, so this only triggers when a caller passes an explicit limit). It enforces schema/column-style length bounds at the API boundary, before data reaches a DB or validator downstream.","triggerScenarios":"Check.NotNull(value, nameof(value), maxLength: 50) with a value longer than 50 characters; an ABP internal guard with a column-width limit receiving oversized input.","commonSituations":"User input longer than the backing DB column; an undersized maxLength on a field whose real data is larger; forgetting to truncate free-text input.","solutions":["Truncate or validate the input length before calling.","Raise maxLength if the current bound is too tight for the real data.","Confirm the data shape (e.g. column width) matches the enforced limit."],"exampleFix":"// before\nCheck.NotNull(longValue, nameof(longValue), maxLength: 50); // throws if >50\n\n// after\nCheck.NotNull(longValue, nameof(longValue), maxLength: 200);","handlingStrategy":"validation","validationCode":"if (value is not null && value.Length > maxLength)\n    value = value.Substring(0, maxLength);\nCheck.NotNull(value, nameof(value), maxLength: maxLength);","typeGuard":"bool WithinMax(string s, int max) => s.Length <= max;","tryCatchPattern":null,"preventionTips":["Truncate user input to the schema column width before forwarding.","Keep maxLength in sync with the backing DB column / DTO attribute.","Validate length at the UI/API boundary so oversized data never reaches the guard."],"tags":["validation","argument","length-check"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}