dotnet/orleans · error · ArgumentNullException
Value cannot be null. (Parameter 'TableName')
Error message
Value cannot be null. (Parameter 'TableName')
What it means
Thrown by the AzureTableDataManager<T> constructor when options.TableName is null. The manager reads TableName from the options during construction and stores it; a null table name would break every subsequent table operation, so it is rejected here. (After this check the name is also validated against Azure table naming rules.)
Source
Thrown at src/Azure/Shared/Storage/AzureTableDataManager.cs:65
/// <summary> Logger for this table manager instance. </summary>
protected internal ILogger Logger { get; }
public AzureStoragePolicyOptions StoragePolicyOptions { get; }
public TableClient Table { get; private set; } = null!;
/// <summary>
/// Creates a new <see cref="AzureTableDataManager{T}"/> instance.
/// </summary>
/// <param name="options">Storage configuration.</param>
/// <param name="logger">Logger to use.</param>
public AzureTableDataManager(AzureStorageOperationOptions options, ILogger logger)
{
this.options = options ?? throw new ArgumentNullException(nameof(options));
Logger = logger ?? throw new ArgumentNullException(nameof(logger));
TableName = options.TableName ?? throw new ArgumentNullException(nameof(options.TableName));
StoragePolicyOptions = options.StoragePolicyOptions ?? throw new ArgumentNullException(nameof(options.StoragePolicyOptions));
AzureTableUtils.ValidateTableName(TableName);
}
/// <summary>
/// Connects to, or creates and initializes a new Azure table if it does not already exist.
/// </summary>
/// <returns>Completion promise for this operation.</returns>
public async Task InitTableAsync()
{
const string operation = "InitTable";
var startTime = DateTime.UtcNow;
try
{
TableServiceClient tableCreationClient = await GetCloudTableCreationClientAsync();
var table = tableCreationClient.GetTableClient(TableName);View on GitHub (pinned to fca799fa70)
Solutions
- Set options.TableName to a valid Azure table name before constructing/initializing the provider.
- Bind TableName from configuration and validate its presence at startup.
- Use the storage builder callback to assign TableName explicitly.
Example fix
// before
silo.AddAzureTableGrainStorage("Default", o => { o.TableServiceClient = client; /* no TableName */ });
// after
silo.AddAzureTableGrainStorage("Default", o =>
{
o.TableServiceClient = client;
o.TableName = "grainstate";
}); Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrWhiteSpace(options.TableName)) throw new InvalidOperationException("TableName must be set"); Type guard
static bool HasTableName(AzureStorageOperationOptions o) => !string.IsNullOrWhiteSpace(o.TableName);
Try / catch
catch (ArgumentNullException ex) when (ex.ParamName == "options.TableName") { /* set options.TableName before constructing */ } Prevention
- Always assign TableName in the storage builder callback.
- Bind TableName from config and validate presence at startup.
When it happens
Trigger: Constructing the manager with an AzureStorageOperationOptions whose TableName was never set.
Common situations: Forgetting to set TableName in the storage/clustering/reminders configuration callback; binding options from config that lacks the TableName key.
Related errors
- Value cannot be null. (Parameter 'createClientCallback')
- Value cannot be null. (Parameter 'connectionString')
- Value cannot be null. (Parameter 'serviceUri')
- Value cannot be null. (Parameter 'tokenCredential')
- Value cannot be null. (Parameter 'azureSasCredential')
AI-assisted analysis of dotnet/orleans@fca799fa70 (2026-08-13).
Data as JSON: /api/errors/5924d7f3e29f867f.
Report an issue: GitHub.