{"record":{"id":"296c964f0c709a82","repo":"stride3d/stride","slug":"paramname-can-t-be-null-empty-or-consist-only-of-whitespace","errorCode":null,"errorMessage":"{paramName} can't be null, empty, or consist only of whitespace characters.","messagePattern":"(.+?) can't be null, empty, or consist only of whitespace characters\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/editor/Stride.Core.Assets.Editor/ArgumentCheck.cs","lineNumber":205,"sourceCode":"        /// <remarks>\n        /// Before checking the <paramref name=\"variable\"/>, a call is made to\n        /// <see cref=\"NotNull\"/>.\n        /// </remarks>\n        /// <exception cref=\"ArgumentNullException\">\n        /// The <paramref name=\"variable\"/> cannot be <see langword=\"null\"/>.\n        /// </exception>\n        /// <exception cref=\"ArgumentException\">\n        /// The <paramref name=\"variable\"/> cannot be an empty <see cref=\"string\"/> or consists only of white-space characters.\n        /// </exception>\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public static void NotWhiteSpace(string variable, string variableName)\n        {\n            var paramName = variableName ?? \"The variable\";\n            // Variable cannot be null\n            NotNull(variable, paramName);\n            if (string.IsNullOrWhiteSpace(variable))\n            {\n                throw new ArgumentException($\"{paramName} can't be null, empty, or consist only of whitespace characters.\");\n            }\n        }\n    }\n\n    /// <summary>\n    /// Same as <see cref=\"ArgumentCheck\"/> but only in DEBUG release.\n    /// </summary>\n    public static class ArgumentDebugCheck\n    {\n        /// <summary>\n        /// Checks wether the <paramref name=\"variable\"/> meets the <see cref=\"predicate\"/>.\n        /// Otherwise throws an exception.\n        /// </summary>\n        /// <typeparam name=\"T\">The type of the <paramref name=\"variable\"/>.</typeparam>\n        /// <param name=\"variable\">The value to check.</param>\n        /// <param name=\"predicate\">The predicate that implements the condition.</param>\n        /// <param name=\"variableName\">The name of the variable being checked.</param>\n        /// <exception cref=\"ArgumentException\">","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/editor/Stride.Core.Assets.Editor/ArgumentCheck.cs#L187-L223","documentation":"ArgumentCheck.NotWhiteSpace throws ArgumentException when a string is null, empty, or consists only of whitespace characters. Null is caught first by NotNull (as ArgumentNullException); empty/whitespace strings raise this ArgumentException with a message naming the parameter.","triggerScenarios":"Calling ArgumentCheck.NotWhiteSpace(variable, variableName) with \"\", \"   \", \"\\t\\n\", or any string where string.IsNullOrWhiteSpace returns true; a config key present but set to blank spaces.","commonSituations":"User left a required text field blank or entered spaces; YAML/JSON config has `key: \"\"` or `key: \" \"`; environment variables set to empty string; trimming removed all meaningful content.","solutions":["Provide a non-blank string value (trim and validate input before the call)","Fix the config/env source: replace blank values with real ones and fail fast at load time with a clear message","Use string.IsNullOrWhiteSpace in the caller to pre-validate and produce a better error","If only null/empty should be rejected but pure whitespace is acceptable, use NotEmpty (string) instead"],"exampleFix":"// before\nvar path = Environment.GetEnvironmentVariable(\"OUTPUT_DIR\"); // \"  \"\nArgumentCheck.NotWhiteSpace(path, nameof(path));\n// after\nvar path = Environment.GetEnvironmentVariable(\"OUTPUT_DIR\")?.Trim();\nif (string.IsNullOrWhiteSpace(path))\n    throw new InvalidDataException(\"OUTPUT_DIR environment variable must be set to a non-blank path\");","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(text))\n    throw new ArgumentException(\"A non-blank string is required\", nameof(text));","typeGuard":"bool IsNotBlank([NotNullWhen(true)] string? s) => !string.IsNullOrWhiteSpace(s);","tryCatchPattern":"try { NotWhiteSpace(configValue, nameof(configValue)); }\ncatch (ArgumentException ex) when (ex.ParamName == nameof(configValue))\n{\n    // report missing/blank configuration with field name\n}","preventionTips":["Validate required config/env values at startup with IsNullOrWhiteSpace","Trim inputs before storing to strip accidental whitespace-only values","In UIs, disable submit while required fields are blank","Distinguish NotEmpty (allows whitespace) vs NotWhiteSpace (rejects it) when choosing a guard"],"tags":["argument-check","argument-exception","whitespace","empty-string","stride"],"backgroundTag":"empty-required-field","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}