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.MaxAttempts)} must be greater than zero. What it means
Thrown by the ADO.NET streaming options validator when MaxAttempts is negative. MaxAttempts bounds how many delivery attempts a message gets before moving to dead letters. Note the check is `< 0`, so zero is technically accepted though the message text says 'greater than zero' — a value of 0 would let messages dead-letter immediately.
Source
Thrown at src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamOptionsValidator.cs:25
/// </summary>
public class AdoNetStreamOptionsValidator(AdoNetStreamOptions options, string name) : IConfigurationValidator
{
/// <inheritdoc />
public void ValidateConfiguration()
{
if (IsNullOrWhiteSpace(options.Invariant))
{
throw new OrleansConfigurationException($"Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Streaming Provider '{name}': {nameof(options.Invariant)} is required.");
}
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)View on GitHub (pinned to fca799fa70)
Solutions
- Set options.MaxAttempts to a positive integer (e.g. the default 5).
- If you want high resilience, use a large finite number rather than a negative sentinel.
- Check the appsettings.json value for typos or a missing-key default of -1.
Example fix
// before
builder.AddAdoNetStreams("ads", o =>
{
o.MaxAttempts = -1; // error
});
// after
builder.AddAdoNetStreams("ads", o =>
{
o.MaxAttempts = 10;
}); Defensive patterns
Strategy: validation
Validate before calling
static void CheckMaxAttempts(AdoNetStreamOptions o)
{
if (o.MaxAttempts < 0)
throw new InvalidOperationException("AdoNetStreamOptions.MaxAttempts must be non-negative; use a positive finite value.");
} Prevention
- Use a positive finite MaxAttempts (default 5).
- Never use a negative sentinel to mean 'unlimited'.
- Bind config keys with a parser that fails on negatives rather than coercing.
When it happens
Trigger: ValidateConfiguration() runs on AdoNetStreamOptions with MaxAttempts < 0. The default is 5, so this only fires if MaxAttempts was explicitly set to a negative integer.
Common situations: Setting MaxAttempts = -1 intending 'unlimited' (not supported); misreading a config key; binding a missing config key that resolves to -1 via a custom parser.
Related errors
- Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Str
- Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Str
- Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Str
- Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Str
- Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Str
AI-assisted analysis of dotnet/orleans@fca799fa70 (2026-08-13).
Data as JSON: /api/errors/d55235162fee8b5b.
Report an issue: GitHub.