{"record":{"id":"f317618571f99b3d","repo":"TechnitiumSoftware/DnsServer","slug":"value-cannot-be-less-than-1","errorCode":null,"errorMessage":"Value cannot be less than 1.","messagePattern":"Value cannot be less than 1\\.","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"DnsServerCore/Dns/DnsServer.cs","lineNumber":7596,"sourceCode":"        public int UdpReceiveBufferSizeKB\n        {\n            get { return _udpReceiveBufferSizeKB; }\n            set\n            {\n                if ((value < 8) || (value > 65536))\n                    throw new ArgumentOutOfRangeException(nameof(UdpReceiveBufferSizeKB), \"Valid range is from 8 KB to 65536 KB.\");\n\n                _udpReceiveBufferSizeKB = value;\n            }\n        }\n\n        public ushort MaxConcurrentResolutionsPerCore\n        {\n            get { return Convert.ToUInt16(_resolverTaskPool.MaximumConcurrencyLevel / Environment.ProcessorCount); }\n            set\n            {\n                if (value < 1)\n                    throw new ArgumentOutOfRangeException(nameof(MaxConcurrentResolutionsPerCore), \"Value cannot be less than 1.\");\n\n                if (MaxConcurrentResolutionsPerCore != value)\n                    ReconfigureResolverTaskPool(value);\n            }\n        }\n\n        public bool EnableEDnsClientSubnetSourceAddress\n        {\n            get { return _enableEDnsClientSubnetSourceAddress; }\n            set { _enableEDnsClientSubnetSourceAddress = value; }\n        }\n\n        public bool EnableDnsOverUdpProxy\n        {\n            get { return _enableDnsOverUdpProxy; }\n            set { _enableDnsOverUdpProxy = value; }\n        }\n","sourceCodeStart":7578,"sourceCodeEnd":7614,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Dns/DnsServer.cs#L7578-L7614","documentation":"Thrown by the MaxConcurrentResolutionsPerCore setter. This ushort property sets how many concurrent DNS resolutions may run per CPU core (it scales the resolver task pool's maximum concurrency). The only constraint is value >= 1; zero is rejected. Assigning 0 additionally triggers a resolver task pool reconfiguration guard.","triggerScenarios":"Assigning DnsServer.MaxConcurrentResolutionsPerCore a value of 0 (the ushort floor). Reached from the settings API or config load. Any value >= 1 is accepted and, if changed, calls ReconfigureResolverTaskPool(value).","commonSituations":"Setting 0 intending 'auto' or 'disabled' — there is no auto mode; 1 is the minimum. UI input defaulting to 0 on an empty field. Misunderstanding that the value is per-core, not absolute.","solutions":["Use a positive value (typically 2-8 per core); 1 is the minimum.","Do not use 0 to disable resolution — instead stop the server or adjust upstream config.","Remember the effective concurrency is value * Environment.ProcessorCount; size accordingly.","When loading from config, coerce 0 to a sane default (e.g. 2) before assigning."],"exampleFix":"// before\n_dnsServer.MaxConcurrentResolutionsPerCore = 0; // throws: < 1\n\n// after\n_dnsServer.MaxConcurrentResolutionsPerCore = 4; // 4 concurrent resolutions per core","handlingStrategy":"validation","validationCode":"ushort EnsureResolutionsPerCore(ushort value) => value < 1 ? (ushort)1 : value;\n\n_dnsServer.MaxConcurrentResolutionsPerCore = EnsureResolutionsPerCore(parsed);","typeGuard":"static bool IsValidResolutionsPerCore(ushort value) => value >= 1;","tryCatchPattern":"try { _dnsServer.MaxConcurrentResolutionsPerCore = parsed; }\ncatch (ArgumentOutOfRangeException ex) when (ex.ParamName == nameof(DnsServer.MaxConcurrentResolutionsPerCore))\n{ _dnsServer.MaxConcurrentResolutionsPerCore = 2; }","preventionTips":["Never use 0 — there is no auto/disable mode.","Remember effective concurrency = value * ProcessorCount.","Coerce empty UI input to a default >= 1."],"tags":["dns","resolver","concurrency","configuration","argumentoutofrange"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}