dotnet/orleans · error · ArgumentNullException
Value cannot be null. (Parameter 'createClientCallback')
Error message
Value cannot be null. (Parameter 'createClientCallback')
What it means
Thrown by AzureBlobJournalStorageOptions.ConfigureBlobServiceClient(Func<...>) when the createClientCallback argument is null. The callback is stored as the factory used to lazily create a BlobServiceClient; a null callback would cause a NullReferenceException later during storage initialization, so it is rejected immediately.
Source
Thrown at src/Azure/Orleans.Journaling.AzureStorage/AzureBlobJournalStorageOptions.cs:172
ArgumentException.ThrowIfNullOrWhiteSpace(connectionString);
CreateClient = ct => Task.FromResult(new BlobServiceClient(connectionString, ClientOptions));
}
/// <summary>
/// Configures the <see cref="BlobServiceClient"/> using an authenticated service URI.
/// </summary>
public void ConfigureBlobServiceClient(Uri serviceUri)
{
ArgumentNullException.ThrowIfNull(serviceUri);
CreateClient = ct => Task.FromResult(new BlobServiceClient(serviceUri, ClientOptions));
}
/// <summary>
/// Configures the <see cref="BlobServiceClient"/> using the provided callback.
/// </summary>
public void ConfigureBlobServiceClient(Func<CancellationToken, Task<BlobServiceClient>> createClientCallback)
{
CreateClient = createClientCallback ?? throw new ArgumentNullException(nameof(createClientCallback));
}
/// <summary>
/// Configures the <see cref="BlobServiceClient"/> using an authenticated service URI and a <see cref="TokenCredential"/>.
/// </summary>
public void ConfigureBlobServiceClient(Uri serviceUri, TokenCredential tokenCredential)
{
ArgumentNullException.ThrowIfNull(serviceUri);
ArgumentNullException.ThrowIfNull(tokenCredential);
CreateClient = ct => Task.FromResult(new BlobServiceClient(serviceUri, tokenCredential, ClientOptions));
}
/// <summary>
/// Configures the <see cref="BlobServiceClient"/> using an authenticated service URI and a <see cref="AzureSasCredential"/>.
/// </summary>
public void ConfigureBlobServiceClient(Uri serviceUri, AzureSasCredential azureSasCredential)
{
ArgumentNullException.ThrowIfNull(serviceUri);View on GitHub (pinned to fca799fa70)
Solutions
- Pass a non-null callback, e.g. options.ConfigureBlobServiceClient(ct => Task.FromResult(new BlobServiceClient(connectionString))).
- If you do not need a custom factory, use one of the other ConfigureBlobServiceClient overloads (connection string, Uri, or Uri+credential).
- Prefer setting BlobServiceClient directly rather than a factory when the client is already constructed.
Example fix
// before Func<CancellationToken, Task<BlobServiceClient>> factory = null!; options.ConfigureBlobServiceClient(factory); // after options.ConfigureBlobServiceClient(ct => Task.FromResult(new BlobServiceClient(connectionString)));
Defensive patterns
Strategy: validation
Validate before calling
if (createClientCallback is null) throw new ArgumentNullException(nameof(createClientCallback)); options.ConfigureBlobServiceClient(createClientCallback);
Prevention
- Prefer the BlobServiceClient property setter or connection-string overload over a raw callback.
- Enable nullable reference types so null callbacks are caught at compile time.
- Pass a lambda directly rather than an uninitialized delegate field.
When it happens
Trigger: Calling options.ConfigureBlobServiceClient((Func<CancellationToken, Task<BlobServiceClient>>)null). The null-coalescing throw runs before assignment.
Common situations: Passing an uninitialized delegate field; a conditional expression that evaluates to null; refactoring that accidentally drops the lambda.
Related errors
- MaxMetadataOnlyConflictRetries must be non-negative.
- MetadataOnlyConflictInitialBackoff must be non-negative.
- MetadataOnlyConflictMaxBackoff must be non-negative.
- WEBSITE_PRIVATE_PORTS must contain at least one TCP port.
- The required setting '{name}' isn't configured.
AI-assisted analysis of dotnet/orleans@fca799fa70 (2026-08-13).
Data as JSON: /api/errors/fd6caf8c6db33504.
Report an issue: GitHub.