TechnitiumSoftware/DnsServer · error · ArgumentOutOfRangeException

Valid range is from 1 to 4.

Error message

Valid range is from 1 to 4.

What it means

Thrown by the ResolverConcurrency property setter when the value is outside [1, 4]. This caps how many concurrent upstream queries the resolver issues per name during resolution (e.g. querying multiple authoritative servers in parallel). The library bounds this to 1–4 to avoid excessive fan-out.

Source

Thrown at DnsServerCore/Dns/DnsServer.cs:7945

        public int ResolverTimeout
        {
            get { return _resolverTimeout; }
            set
            {
                if ((value < 1000) || (value > 10000))
                    throw new ArgumentOutOfRangeException(nameof(ResolverTimeout), "Valid range is from 1000 to 10000.");

                _resolverTimeout = value;
            }
        }

        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

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Use a value in 1–4 inclusive (2 is a reasonable default balancing speed and load).
  2. Clamp external config into the valid range before assignment.
  3. Prefer tuning ResolverRetries/Timeout over pushing concurrency past 4.

Example fix

// before
server.ResolverConcurrency = 8;

// after
server.ResolverConcurrency = 4;
Defensive patterns

Strategy: validation

Validate before calling

static int ClampConcurrency(int v) => Math.Clamp(v, 1, 4);
server.ResolverConcurrency = ClampConcurrency(configConcurrency);

Type guard

static bool IsValidResolverConcurrency(int v) => v >= 1 && v <= 4;

Try / catch

try { server.ResolverConcurrency = c; }
catch (ArgumentOutOfRangeException) { server.ResolverConcurrency = 2; }

Prevention

When it happens

Trigger: Setting DnsServer.ResolverConcurrency to 0, a negative number, or a value greater than 4.

Common situations: Trying to raise concurrency expecting faster resolution; setting 0; reading an uncapped value from config.

Related errors


AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13). Data as JSON: /api/errors/b2c71efabf03b753. Report an issue: GitHub.