TechnitiumSoftware/DnsServer · error · ArgumentOutOfRangeException

Valid range is from 1 to 1000.

Error message

Valid range is from 1 to 1000.

What it means

Thrown by the QuicMaxInboundStreams setter, which caps how many concurrent bidirectional QUIC streams a remote peer may open against the DNS-over-QUIC listener. IMPORTANT source inconsistency: the guard tests (value < 0) || (value > 1000), so 0 is actually accepted, yet the error message claims the valid range is '1 to 1000'. Treat 0 as effectively permitted by code but discouraged; any negative value or anything above 1000 throws.

Source

Thrown at DnsServerCore/Dns/DnsServer.cs:7554

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

                _quicIdleTimeout = value;
            }
        }

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

                _quicMaxInboundStreams = value;
            }
        }

        public int ListenBacklog
        {
            get { return _listenBacklog; }
            set { _listenBacklog = value; }
        }

        public int UdpSendBufferSizeKB
        {
            get { return _udpSendBufferSizeKB; }
            set
            {
                if ((value < 8) || (value > 65536))
                    throw new ArgumentOutOfRangeException(nameof(UdpSendBufferSizeKB), "Valid range is from 8 KB to 65536 KB.");

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Use a value in 0..1000 (the enforced range); pick a positive value like 100 if you want the documented '1 to 1000' behavior.
  2. If you need effectively-unlimited inbound streams, use the maximum 1000 rather than a larger number.
  3. Be aware 0 is accepted by code — if your downstream logic assumes >= 1, validate explicitly.
  4. Fix the source message to say '0 to 1000' if the < 0 check is intentional, or change the check to (value < 1) if 0 should be rejected.

Example fix

// before
_dnsServer.QuicMaxInboundStreams = 5000; // throws: > 1000

// after
_dnsServer.QuicMaxInboundStreams = 1000;  // enforced maximum
Defensive patterns

Strategy: validation

Validate before calling

static int ClampQuicStreams(int value)
{
    if (value < 0) return 0;      // code actually accepts 0
    if (value > 1000) return 1000;
    return value;
}

_dnsServer.QuicMaxInboundStreams = ClampQuicStreams(parsedStreams);

Type guard

// NOTE: code enforces 0..1000 even though the message says '1 to 1000'.
static bool IsValidQuicStreams(int value) => value >= 0 && value <= 1000;

Try / catch

try { _dnsServer.QuicMaxInboundStreams = parsedStreams; }
catch (ArgumentOutOfRangeException ex) when (ex.ParamName == nameof(DnsServer.QuicMaxInboundStreams))
{ _dnsServer.QuicMaxInboundStreams = 100; }

Prevention

When it happens

Trigger: Assigning DnsServer.QuicMaxInboundStreams a negative value or a value > 1000. Reached via the settings Web API field or via DnsWebServiceLegacy binary config deserialization. A value of exactly 0 does NOT throw despite the message.

Common situations: Misreading the message and assuming 0 is invalid (it passes). Typing a large number like 5000 expecting 'unlimited' streams. Importing a config whose stream limit exceeds the QUIC library cap of 1000.

Related errors


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