{"record":{"id":"ab304a853d9d748b","repo":"TechnitiumSoftware/DnsServer","slug":"valid-range-is-from-10-to-30","errorCode":null,"errorMessage":"Valid range is from 10 to 30.","messagePattern":"Valid range is from 10 to 30\\.","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"DnsServerCore/Dns/DnsServer.cs","lineNumber":7957,"sourceCode":"        public int ResolverConcurrency\n        {\n            get { return _resolverConcurrency; }\n            set\n            {\n                if ((value < 1) || (value > 4))\n                    throw new ArgumentOutOfRangeException(nameof(ResolverConcurrency), \"Valid range is from 1 to 4.\");\n\n                _resolverConcurrency = value;\n            }\n        }\n\n        public int ResolverMaxStackCount\n        {\n            get { return _resolverMaxStackCount; }\n            set\n            {\n                if ((value < 10) || (value > 30))\n                    throw new ArgumentOutOfRangeException(nameof(ResolverMaxStackCount), \"Valid range is from 10 to 30.\");\n\n                _resolverMaxStackCount = value;\n            }\n        }\n\n        public bool SaveCacheToDisk\n        {\n            get { return _saveCacheToDisk; }\n            set\n            {\n                _saveCacheToDisk = value;\n\n                if (!_saveCacheToDisk)\n                {\n                    try\n                    {\n                        _cacheZoneManager.DeleteCacheZoneFile();\n                    }","sourceCodeStart":7939,"sourceCodeEnd":7975,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Dns/DnsServer.cs#L7939-L7975","documentation":"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.","triggerScenarios":"Setting DnsServer.ResolverMaxStackCount to a value < 10 or > 30.","commonSituations":"Lowering it to be aggressive about stopping loops; raising it hoping to resolve deeply chained CNAMEs; mis-typing the units.","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."],"exampleFix":"// before\nserver.ResolverMaxStackCount = 5;\n\n// after\nserver.ResolverMaxStackCount = 10;","handlingStrategy":"validation","validationCode":"static int ClampStackCount(int v) => Math.Clamp(v, 10, 30);\nserver.ResolverMaxStackCount = ClampStackCount(configStack);","typeGuard":"static bool IsValidMaxStackCount(int v) => v >= 10 && v <= 30;","tryCatchPattern":"try { server.ResolverMaxStackCount = s; }\ncatch (ArgumentOutOfRangeException) { server.ResolverMaxStackCount = 10; }","preventionTips":["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."],"tags":["dns","configuration","validation","resolver","limits"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}