{"record":{"id":"4b5bccee4e18c8de","repo":"abpframework/abp","slug":"parametername-can-not-be-null-empty-or-white-sp","errorCode":null,"errorMessage":"{parameterName} can not be null, empty or white space!","messagePattern":"(.+?) can not be null, empty or white space!","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Core/Volo/Abp/Check.cs","lineNumber":72,"sourceCode":"\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())\n        {\n            throw new ArgumentException($\"{parameterName} can not be null, empty or white space!\", 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 NotNullOrEmpty(\n        [System.Diagnostics.CodeAnalysis.NotNull] string? value,","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs#L54-L90","documentation":"Check.NotNullOrWhiteSpace(string) rejects null, empty, or all-whitespace strings using IsNullOrWhiteSpace(), so whitespace-only values also fail (stricter than NotNullOrEmpty). After the whitespace check it applies optional maxLength/minLength bounds. Use this when the string must carry meaningful content, not just be present.","triggerScenarios":"Check.NotNullOrWhiteSpace(\"   \", nameof(x)), or an empty string, or null; an ABP API that requires a non-blank value receiving whitespace.","commonSituations":"Configuration keys that must have a value; display names; identifiers that cannot be whitespace; trimmed user input that ended up blank.","solutions":["Pass a non-empty, non-whitespace string.","If blank is a valid 'unset' state, default-fall to a meaningful value at the caller before calling.","Trim input upstream and validate before forwarding into the guarded API."],"exampleFix":"// before\nCheck.NotNullOrWhiteSpace(raw, nameof(raw)); // throws on blank\n\n// after\nCheck.NotNullOrWhiteSpace(string.IsNullOrWhiteSpace(raw) ? \"default\" : raw, nameof(raw));","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(value))\n    value = fallback;\nCheck.NotNullOrWhiteSpace(value, nameof(value));","typeGuard":"bool IsMeaningful(string? s) => !string.IsNullOrWhiteSpace(s);","tryCatchPattern":null,"preventionTips":["Trim and default-fall blank input at the caller before guarded APIs.","Prefer Check.NotNullOrWhiteSpace over NotNullOrEmpty when blank must fail.","Use [Required] on DTO properties so model binding rejects whitespace before your code runs."],"tags":["validation","argument","whitespace"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}