dotnet/orleans · error · ArgumentNullException
Value cannot be null. (Parameter 'options')
Error message
Value cannot be null. (Parameter 'options')
What it means
Thrown by the AzureTableDataManager<T> constructor when the options argument is null. The manager cannot function without storage configuration, so construction fails immediately rather than later during InitTableAsync.
Source
Thrown at src/Azure/Shared/Storage/AzureTableDataManager.cs:62
/// <summary> Name of the table this instance is managing. </summary>
public string TableName { get; }
/// <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;
tryView on GitHub (pinned to fca799fa70)
Solutions
- Pass a fully configured, non-null AzureStorageOperationOptions.
- Resolve options from DI rather than constructing by hand.
- Null-check at the call site with a clearer message if needed.
Example fix
// before
var mgr = new AzureTableDataManager<MyEntity>(options, logger); // options null
// after
var opts = services.GetRequiredService<AzureStorageOperationOptions>();
var mgr = new AzureTableDataManager<MyEntity>(opts ?? throw new InvalidOperationException("options not registered"), logger); Defensive patterns
Strategy: validation
Validate before calling
var opts = options ?? throw new ArgumentNullException(nameof(options)); var mgr = new AzureTableDataManager<T>(opts, logger);
Type guard
static bool HasOptions(AzureStorageOperationOptions? o) => o is not null;
Try / catch
catch (ArgumentNullException ex) when (ex.ParamName == "options") { /* resolve options from DI */ } Prevention
- Resolve AzureStorageOperationOptions from DI rather than constructing by hand.
- Null-check at the call site with a domain-specific message.
When it happens
Trigger: Constructing AzureTableDataManager<T> directly with a null AzureStorageOperationOptions, or a DI/factory path that resolves options to null.
Common situations: Custom provider that news up the manager without resolving options from DI; tests that pass null accidentally; refactoring that moved options resolution.
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/81561ef2cf620850.
Report an issue: GitHub.