{"record":{"id":"708e7c3f8db16b79","repo":"dotnet/orleans","slug":"invalid-nameof-adonetstreamoptions-values-for-a-708e7c","errorCode":null,"errorMessage":"Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Streaming Provider '{name}': {nameof(options.EvictionInterval)} must be greater than zero.","messagePattern":"Invalid (.+?) values for ADO\\.NET Streaming Provider '(.+?)': (.+?) must be greater than zero\\.","errorType":"validation","errorClass":"OrleansConfigurationException","httpStatus":null,"severity":"error","filePath":"src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamOptionsValidator.cs","lineNumber":35,"sourceCode":"\n        if (IsNullOrWhiteSpace(options.ConnectionString) == (options.DataSource is null))\n        {\n            throw new OrleansConfigurationException($\"Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Streaming Provider '{name}': configure exactly one of {nameof(options.ConnectionString)} or {nameof(options.DataSource)}.\");\n        }\n\n        if (options.MaxAttempts < 0)\n        {\n            throw new OrleansConfigurationException($\"Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Streaming Provider '{name}': {nameof(options.MaxAttempts)} must be greater than zero.\");\n        }\n\n        if (options.VisibilityTimeout < TimeSpan.Zero)\n        {\n            throw new OrleansConfigurationException($\"Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Streaming Provider '{name}': {nameof(options.VisibilityTimeout)} must be greater than zero.\");\n        }\n\n        if (options.EvictionInterval < TimeSpan.Zero)\n        {\n            throw new OrleansConfigurationException($\"Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Streaming Provider '{name}': {nameof(options.EvictionInterval)} must be greater than zero.\");\n        }\n\n        if (options.ExpiryTimeout < TimeSpan.Zero)\n        {\n            throw new OrleansConfigurationException($\"Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Streaming Provider '{name}': {nameof(options.ExpiryTimeout)} must be greater than zero.\");\n        }\n\n        if (options.DeadLetterEvictionTimeout < TimeSpan.Zero)\n        {\n            throw new OrleansConfigurationException($\"Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Streaming Provider '{name}': {nameof(options.DeadLetterEvictionTimeout)} must be greater than zero.\");\n        }\n\n        if (options.EvictionBatchSize < 0)\n        {\n            throw new OrleansConfigurationException($\"Invalid {nameof(AdoNetStreamOptions)} values for ADO.NET Streaming Provider '{name}': {nameof(options.EvictionBatchSize)} must be greater than zero.\");\n        }\n    }\n}","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamOptionsValidator.cs#L17-L53","documentation":"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.","triggerScenarios":"ValidateConfiguration() runs on AdoNetStreamOptions with EvictionInterval < TimeSpan.Zero. The default is 10 seconds, so this only fires if it was explicitly set negative.","commonSituations":"Setting EvictionInterval to a negative TimeSpan; a malformed config string; tuning eviction aggressively and mistyping the sign.","solutions":["Set options.EvictionInterval to a positive TimeSpan (e.g. the default 10 seconds).","Check the appsettings.json string format and sign.","Use TimeSpan.FromSeconds to set it explicitly."],"exampleFix":"// before\nbuilder.AddAdoNetStreams(\"ads\", o =>\n{\n    o.EvictionInterval = TimeSpan.FromSeconds(-5);\n});\n\n// after\nbuilder.AddAdoNetStreams(\"ads\", o =>\n{\n    o.EvictionInterval = TimeSpan.FromSeconds(10);\n});","handlingStrategy":"validation","validationCode":"static void CheckEvictionInterval(AdoNetStreamOptions o)\n{\n    if (o.EvictionInterval < TimeSpan.Zero)\n        throw new InvalidOperationException(\"AdoNetStreamOptions.EvictionInterval must be non-negative.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use TimeSpan.FromSeconds with a positive value (default 10s).","Validate duration strings in config tests.","Avoid negative TimeSpans derived from tick arithmetic."],"tags":["configuration","adonet","streaming","eviction","startup-validation"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}