dotnet/orleans · error · OrleansConfigurationException

Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Str

Error message

Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Streaming Provider '{name}': {nameof(options.EvictionInterval)} must be greater than zero.

What it means

Thrown by the ADO.NET streaming options validator when EvictionInterval is negative. EvictionInterval is the cluster-wide period between dead-letter and expiry sweeps. The check is `< TimeSpan.Zero`, so zero is accepted though the message says 'greater than zero' — zero would spin the eviction loop as fast as possible.

Source

Thrown at src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamOptionsValidator.cs:35

        if (IsNullOrWhiteSpace(options.ConnectionString) == (options.DataSource is null))
        {
            throw new OrleansConfigurationException($"Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Streaming Provider '{name}': configure exactly one of {nameof(options.ConnectionString)} or {nameof(options.DataSource)}.");
        }

        if (options.MaxAttempts < 0)
        {
            throw new OrleansConfigurationException($"Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Streaming Provider '{name}': {nameof(options.MaxAttempts)} must be greater than zero.");
        }

        if (options.VisibilityTimeout < TimeSpan.Zero)
        {
            throw new OrleansConfigurationException($"Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Streaming Provider '{name}': {nameof(options.VisibilityTimeout)} must be greater than zero.");
        }

        if (options.EvictionInterval < TimeSpan.Zero)
        {
            throw new OrleansConfigurationException($"Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Streaming Provider '{name}': {nameof(options.EvictionInterval)} must be greater than zero.");
        }

        if (options.ExpiryTimeout < TimeSpan.Zero)
        {
            throw new OrleansConfigurationException($"Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Streaming Provider '{name}': {nameof(options.ExpiryTimeout)} must be greater than zero.");
        }

        if (options.DeadLetterEvictionTimeout < TimeSpan.Zero)
        {
            throw new OrleansConfigurationException($"Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Streaming Provider '{name}': {nameof(options.DeadLetterEvictionTimeout)} must be greater than zero.");
        }

        if (options.EvictionBatchSize < 0)
        {
            throw new OrleansConfigurationException($"Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Streaming Provider '{name}': {nameof(options.EvictionBatchSize)} must be greater than zero.");
        }
    }
}

View on GitHub (pinned to fca799fa70)

Solutions

  1. Set options.EvictionInterval to a positive TimeSpan (e.g. the default 10 seconds).
  2. Check the appsettings.json string format and sign.
  3. Use TimeSpan.FromSeconds to set it explicitly.

Example fix

// before
builder.AddAdoNetStreams("ads", o =>
{
    o.EvictionInterval = TimeSpan.FromSeconds(-5);
});

// after
builder.AddAdoNetStreams("ads", o =>
{
    o.EvictionInterval = TimeSpan.FromSeconds(10);
});
Defensive patterns

Strategy: validation

Validate before calling

static void CheckEvictionInterval(AdoNetStreamOptions o)
{
    if (o.EvictionInterval < TimeSpan.Zero)
        throw new InvalidOperationException("AdoNetStreamOptions.EvictionInterval must be non-negative.");
}

Prevention

When it happens

Trigger: ValidateConfiguration() runs on AdoNetStreamOptions with EvictionInterval < TimeSpan.Zero. The default is 10 seconds, so this only fires if it was explicitly set negative.

Common situations: Setting EvictionInterval to a negative TimeSpan; a malformed config string; tuning eviction aggressively and mistyping the sign.

Related errors


AI-assisted analysis of dotnet/orleans@fca799fa70 (2026-08-13). Data as JSON: /api/errors/708e7c3f8db16b79. Report an issue: GitHub.