SignalR/SignalR · error · ArgumentOutOfRangeException

value

Error message

value

What it means

ArgumentOutOfRangeException on the TableCount setter: the SQL backplane needs at least one message table, so any value < 1 is rejected. TableCount controls how many Messages_N tables are created to reduce lock contention across farm nodes.

Source

Thrown at src/Microsoft.AspNet.SignalR.SqlServer/SqlScaleoutConfiguration.cs:46

        /// </summary>
        public string ConnectionString { get; private set; }

        /// <summary>
        /// The number of tables to store messages in. Using more tables reduces lock contention and may increase throughput.
        /// This must be consistent between all nodes in the web farm.
        /// Defaults to 1.
        /// </summary>
        public int TableCount
        {
            get
            {
                return _tableCount;
            }
            set
            {
                if (value < 1)
                {
                    throw new ArgumentOutOfRangeException("value");
                }
                _tableCount = value;
            }
        }
    }
}

View on GitHub (pinned to 693053b89a)

Solutions

  1. Set TableCount to a positive integer (1 is the default and minimum).
  2. Clamp any computed value to at least 1 before assigning.
  3. Validate the config-sourced value at startup.

Example fix

// before
config.TableCount = desiredTables; // desiredTables is 0 -> throw

// after
config.TableCount = Math.Max(1, desiredTables);
Defensive patterns

Strategy: validation

Validate before calling

int tableCount = Math.Max(1, desiredTableCount);
config.TableCount = tableCount;

Prevention

When it happens

Trigger: config.TableCount = 0 (or any negative value) is assigned, hitting the guard at SqlScaleoutConfiguration.cs:46.

Common situations: TableCount is read from a config setting that defaults to 0; a calculation that can yield zero (e.g. based on CPU/instance count) is wired into TableCount; an off-by-one when scaling down.

Related errors


AI-assisted analysis of SignalR/SignalR@693053b89a (2026-08-13). Data as JSON: /api/errors/159bd1cbfbf939ef. Report an issue: GitHub.