dotnet/orleans · error · ArgumentNullException
Value cannot be null. (Parameter 'connectionString')
Error message
Value cannot be null. (Parameter 'connectionString')
What it means
Thrown by AzureStorageOperationOptions.SetTableServiceClient(string connectionString) when the connection string is null or whitespace. Internally invoked by the obsolete ConfigureTableServiceClient(string) overload. A blank connection string cannot construct a TableServiceClient, so it is rejected before any Azure call.
Source
Thrown at src/Azure/Shared/Storage/AzureStorageOperationOptions.cs:125
/// </summary>
[Obsolete($"Set the {nameof(TableServiceClient)} property directly.")]
public void ConfigureTableServiceClient(Uri serviceUri, AzureSasCredential azureSasCredential)
{
SetTableServiceClient(serviceUri, azureSasCredential);
}
/// <summary>
/// Configures the <see cref="TableServiceClient"/> using an authenticated service URI and a <see cref="TableSharedKeyCredential"/>.
/// </summary>
[Obsolete($"Set the {nameof(TableServiceClient)} property directly.")]
public void ConfigureTableServiceClient(Uri serviceUri, TableSharedKeyCredential sharedKeyCredential)
{
SetTableServiceClient(serviceUri, sharedKeyCredential);
}
internal void SetTableServiceClient(string connectionString)
{
if (string.IsNullOrWhiteSpace(connectionString)) throw new ArgumentNullException(nameof(connectionString));
_tableServiceClient = null;
CreateClient = () => Task.FromResult(new TableServiceClient(connectionString, GetTableClientOptions()));
}
internal void SetTableServiceClient(Uri serviceUri)
{
if (serviceUri is null) throw new ArgumentNullException(nameof(serviceUri));
_tableServiceClient = null;
CreateClient = () => Task.FromResult(new TableServiceClient(serviceUri, GetTableClientOptions()));
}
internal void SetTableServiceClient(Uri serviceUri, TokenCredential tokenCredential)
{
if (serviceUri is null) throw new ArgumentNullException(nameof(serviceUri));
if (tokenCredential is null) throw new ArgumentNullException(nameof(tokenCredential));
_tableServiceClient = null;
CreateClient = () => Task.FromResult(new TableServiceClient(serviceUri, tokenCredential, GetTableClientOptions()));
}View on GitHub (pinned to fca799fa70)
Solutions
- Provide a valid Azure Storage connection string (or, preferred, set TableServiceClient directly).
- Verify the config key exists and is bound via configuration binding before calling configure.
- Fail fast at startup with a clear message if the connection string section is absent.
Example fix
// before
options.ConfigureTableServiceClient(config["AzureStorageConnectionString"]); // null if key missing
// after
var cs = config["AzureStorageConnectionString"] ?? throw new InvalidOperationException("Missing AzureStorageConnectionString");
options.TableServiceClient = new TableServiceClient(cs); Defensive patterns
Strategy: validation
Validate before calling
var cs = config["AzureStorageConnectionString"];
if (string.IsNullOrWhiteSpace(cs)) throw new InvalidOperationException("Missing AzureStorageConnectionString");
options.TableServiceClient = new TableServiceClient(cs); Type guard
static bool HasConnectionString(string? s) => !string.IsNullOrWhiteSpace(s);
Try / catch
catch (ArgumentNullException ex) when (ex.ParamName == "connectionString") { /* verify the config key and secret source */ } Prevention
- Validate connection-string presence at startup with a clear message.
- Keep connection strings in the secret store, not source.
- Prefer setting TableServiceClient directly.
When it happens
Trigger: Calling ConfigureTableServiceClient(connectionString) with a null/empty string, typically because a configuration key (e.g. "AzureStorageConnectionString") was missing from appsettings or environment.
Common situations: Missing or renamed connection-string key in appsettings.json / environment variables; secret not loaded in the deployed environment; local dev using placeholder that resolves to empty.
Related errors
- Value cannot be null. (Parameter 'createClientCallback')
- Value cannot be null. (Parameter 'serviceUri')
- Value cannot be null. (Parameter 'tokenCredential')
- Value cannot be null. (Parameter 'azureSasCredential')
- Value cannot be null. (Parameter 'sharedKeyCredential')
AI-assisted analysis of dotnet/orleans@fca799fa70 (2026-08-13).
Data as JSON: /api/errors/3038b94151ce5709.
Report an issue: GitHub.