{"record":{"id":"3c8957b3341f8898","repo":"abpframework/abp","slug":"parametername-can-not-be-null","errorCode":null,"errorMessage":"{parameterName} can not be null!","messagePattern":"(.+?) can not be null!","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Core/Volo/Abp/Check.cs","lineNumber":47,"sourceCode":"    {\n        if (value == null)\n        {\n            throw new ArgumentNullException(parameterName, message);\n        }\n\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,","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs#L29-L65","documentation":"The string overload of Check.NotNull validates that a string is non-null and within optional maxLength/minLength bounds (defaults: maxLength=int.MaxValue, minLength=0). This overload deliberately throws ArgumentException (not ArgumentNullException) with a human-readable message; it differs from the generic Check.NotNull<T> which throws ArgumentNullException. It is ABP's standard pre-condition guard used pervasively across the framework.","triggerScenarios":"Check.NotNull(someString, nameof(someString)) when someString is null; equivalently an ABP internal call guarding a string parameter receives null.","commonSituations":"Passing null where a required string (name, key, connection string) is expected; a config value resolved to null and forwarded into an ABP API.","solutions":["Pass a non-null string.","If the value may legitimately be absent, resolve to a default (e.g. string.Empty) at the caller before invoking the guarded API.","Trace the parameter name in the message back to the offending argument."],"exampleFix":"// before\nCheck.NotNull(maybeNull, nameof(maybeNull));\n\n// after\nCheck.NotNull(maybeNull ?? string.Empty, nameof(maybeNull));","handlingStrategy":"validation","validationCode":"if (value is null) throw new ArgumentNullException(nameof(value));\n// or resolve to a default before the guarded call:\nCheck.NotNull(value ?? string.Empty, nameof(value));","typeGuard":"bool IsPresent(string? s) => s is not null;","tryCatchPattern":null,"preventionTips":["Coalesce optional strings to a default at the caller before invoking guarded ABP APIs.","Enable nullable reference types so the compiler warns on null propagation.","Trace the parameter name in the message back to the offending argument."],"tags":["validation","argument","precondition","null-check"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}