TechnitiumSoftware/DnsServer · error · ArgumentOutOfRangeException
Valid range is from 10 to 30.
Error message
Valid range is from 10 to 30.
What it means
Thrown by the ResolverMaxStackCount property setter when the value is outside [10, 30]. This bounds the maximum CNAME/DNAME referral chain depth the resolver will follow before giving up, preventing infinite-loop resolution and runaway resource use.
Source
Thrown at DnsServerCore/Dns/DnsServer.cs:7957
public int ResolverConcurrency
{
get { return _resolverConcurrency; }
set
{
if ((value < 1) || (value > 4))
throw new ArgumentOutOfRangeException(nameof(ResolverConcurrency), "Valid range is from 1 to 4.");
_resolverConcurrency = value;
}
}
public int ResolverMaxStackCount
{
get { return _resolverMaxStackCount; }
set
{
if ((value < 10) || (value > 30))
throw new ArgumentOutOfRangeException(nameof(ResolverMaxStackCount), "Valid range is from 10 to 30.");
_resolverMaxStackCount = value;
}
}
public bool SaveCacheToDisk
{
get { return _saveCacheToDisk; }
set
{
_saveCacheToDisk = value;
if (!_saveCacheToDisk)
{
try
{
_cacheZoneManager.DeleteCacheZoneFile();
}View on GitHub (pinned to d0484b6c1e)
Solutions
- Choose a value in 10–30 inclusive (the default is typically adequate).
- If you hit resolution failures on long CNAME chains, raise toward 30 rather than above it.
- Clamp config input to the allowed range.
Example fix
// before server.ResolverMaxStackCount = 5; // after server.ResolverMaxStackCount = 10;
Defensive patterns
Strategy: validation
Validate before calling
static int ClampStackCount(int v) => Math.Clamp(v, 10, 30); server.ResolverMaxStackCount = ClampStackCount(configStack);
Type guard
static bool IsValidMaxStackCount(int v) => v >= 10 && v <= 30;
Try / catch
try { server.ResolverMaxStackCount = s; }
catch (ArgumentOutOfRangeException) { server.ResolverMaxStackCount = 10; } Prevention
- Clamp the value into 10–30 from config.
- Only raise it if you have evidence of legitimate long CNAME chains.
- Pair with monitoring of resolution failures.
When it happens
Trigger: Setting DnsServer.ResolverMaxStackCount to a value < 10 or > 30.
Common situations: Lowering it to be aggressive about stopping loops; raising it hoping to resolve deeply chained CNAMEs; mis-typing the units.
Related errors
- Valid range is from 1 to 10.
- Valid range is from 1 to 4.
- Serve stale max wait time valid range is 0 to 1800 milliseco
- TSIG keys cannot have more than 255 entries.
- Value cannot be less than 1.
AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13).
Data as JSON: /api/errors/ab304a853d9d748b.
Report an issue: GitHub.