{"record":{"id":"492c78af0ca87b28","repo":"github/copilot-sdk","slug":"the-value-cannot-be-an-empty-string-or-composed-en","errorCode":null,"errorMessage":"The value cannot be an empty string or composed entirely of whitespace.","messagePattern":"The value cannot be an empty string or composed entirely of whitespace\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Polyfills/DownlevelExtensions.cs","lineNumber":55,"sourceCode":"                }\n            }\n        }\n    }\n\n    internal static class DownlevelArgumentExceptionExtensions\n    {\n        extension(ArgumentException)\n        {\n            public static void ThrowIfNullOrWhiteSpace(string? argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null)\n            {\n                if (argument is null)\n                {\n                    throw new ArgumentNullException(paramName);\n                }\n\n                if (string.IsNullOrWhiteSpace(argument))\n                {\n                    throw new ArgumentException(\"The value cannot be an empty string or composed entirely of whitespace.\", paramName);\n                }\n            }\n        }\n    }\n\n    internal static class DownlevelDateTimeExtensions\n    {\n        extension(DateTime)\n        {\n            public static DateTime UnixEpoch => new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);\n        }\n    }\n\n    internal static class DownlevelDateTimeOffsetExtensions\n    {\n        extension(DateTimeOffset)\n        {\n            public static DateTimeOffset UnixEpoch => new(1970, 1, 1, 0, 0, 0, TimeSpan.Zero);","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/dotnet/src/Polyfills/DownlevelExtensions.cs#L37-L73","documentation":"This is thrown by a downlevel (polyfill) implementation of ArgumentNullException.ThrowIfNullOrWhiteSpace-style guards for runtimes lacking the modern APIs. It fires when an argument-guard helper (e.g. ValidateNotNullOrWhiteSpace) is given a string that is empty or whitespace-only, keeping argument validation consistent on older TFMs.","triggerScenarios":"Calling any library API whose parameter guard calls DownlevelArgumentExceptionExtensions with \"\", \" \", \"\\t\", or a whitespace-only string for a name/path/key-like argument (e.g. session name, tool name, event name).","commonSituations":"Reading a required value from environment variables or config files that exist but are empty; string.Split or trimming producing empty entries passed onward; users passing String.Empty as a placeholder for a required name.","solutions":["Supply a non-empty, non-whitespace value for the argument before calling the API.","Guard with string.IsNullOrWhiteSpace and throw or substitute a valid default in your own code.","Fix the upstream source: check config files/env vars for empty values that get passed through."],"exampleFix":"// before\nsession.SetName(\"\");\n\n// after\nif (string.IsNullOrWhiteSpace(name)) throw new ArgumentException(\"Name required\", nameof(name));\nsession.SetName(name);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(value)) throw new ArgumentException(\"Value required and non-empty\", nameof(value));","typeGuard":"static bool IsProvided(string? s) => !string.IsNullOrWhiteSpace(s);","tryCatchPattern":"try { api.Call(name); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"empty string or composed entirely of whitespace\"))\n{ logger.LogWarning(\"Argument {Param} was blank\", ex.ParamName); }","preventionTips":["Validate string args with string.IsNullOrWhiteSpace at boundaries","Check env vars and config files for empty values before use","Never pass String.Empty as a placeholder for required names"],"tags":["argument-validation","empty-string","polyfill","dotnet"],"backgroundTag":"empty-required-field","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}