SignalR/SignalR · error · ArgumentNullException
connectionString
Error message
connectionString
What it means
ArgumentNullException guard in the StackExchangeRedis RedisScaleoutConfiguration constructor: connectionString must not be null. Note this checks only null (not empty) — an empty string is permitted and simply skips ConfigurationOptions parsing and Database detection.
Source
Thrown at src/Microsoft.AspNet.SignalR.StackExchangeRedis/RedisScaleoutConfiguration.cs:25
using StackExchange.Redis;
namespace Microsoft.AspNet.SignalR
{
/// <summary>
/// Settings for the Redis scale-out message bus implementation.
/// </summary>
public class RedisScaleoutConfiguration : ScaleoutConfiguration
{
public RedisScaleoutConfiguration(string server, int port, string password, string eventKey)
: this(CreateConnectionString(server, port, password), eventKey)
{
}
public RedisScaleoutConfiguration(string connectionString, string eventKey)
{
if (connectionString == null)
{
throw new ArgumentNullException("connectionString");
}
if (eventKey == null)
{
throw new ArgumentNullException("eventKey");
}
ConnectionString = connectionString;
if (connectionString.Length > 0)
{
var options = ConfigurationOptions.Parse(connectionString);
Database = options.DefaultDatabase.GetValueOrDefault(0);
}
EventKey = eventKey;
}
/// <summary>
/// The connection string that needs to be passed to ConnectionMultiplexerView on GitHub (pinned to 693053b89a)
Solutions
- Provide a non-null connection string of the form 'host:port,password=...,abortConnect=false'.
- If loading from config, verify the setting exists; treat missing as a startup error.
- Prefer the (server, port, password, eventKey) overload which builds the string for you.
Example fix
// before
var cs = ConfigurationManager.AppSettings["RedisConn"];
var config = new RedisScaleoutConfiguration(cs, "SignalR"); // cs null -> throw
// after
var config = new RedisScaleoutConfiguration("redis.example.com", 6379, "password", "SignalR");
// or guard:
var cs = ConfigurationManager.AppSettings["RedisConn"] ?? throw new ConfigurationErrorsException("RedisConn missing");
var config = new RedisScaleoutConfiguration(cs, "SignalR"); Defensive patterns
Strategy: validation
Validate before calling
if (connectionString == null) throw new ArgumentNullException(nameof(connectionString)); var config = new RedisScaleoutConfiguration(connectionString, eventKey);
Prevention
- Validate the connection-string config value is non-null at startup.
- Prefer the (server, port, password, eventKey) overload which builds the string.
- Note: empty string is allowed (skips Database parsing) — only null throws.
When it happens
Trigger: new RedisScaleoutConfiguration(null, eventKey) is constructed (or the server/port/password overload builds a null string), hitting the guard at RedisScaleoutConfiguration.cs:25.
Common situations: The connection string is sourced from a missing config key and is null; a variable that was never assigned is passed; the 4-argument overload is fed a null server. Note: CreateConnectionString formats with string.Format so a null server would not itself trigger this guard (it produces "...password=...") — the null check specifically catches a null connectionString argument to the 2-arg constructor.
Related errors
AI-assisted analysis of SignalR/SignalR@693053b89a (2026-08-13).
Data as JSON: /api/errors/4c0c976009b9f30e.
Report an issue: GitHub.