{"record":{"id":"1d00c41272db0a20","repo":"TechnitiumSoftware/DnsServer","slug":"lease-time-in-minutes-must-be-between-0-to-59","errorCode":null,"errorMessage":"Lease time in minutes must be between 0 to 59.","messagePattern":"Lease time in minutes must be between 0 to 59\\.","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"DnsServerCore/Dhcp/Scope.cs","lineNumber":1910,"sourceCode":"        public byte LeaseTimeHours\n        {\n            get { return _leaseTimeHours; }\n            set\n            {\n                if (value > 23)\n                    throw new ArgumentOutOfRangeException(nameof(LeaseTimeHours), \"Lease time in hours must be between 0 to 23.\");\n\n                _leaseTimeHours = value;\n            }\n        }\n\n        public byte LeaseTimeMinutes\n        {\n            get { return _leaseTimeMinutes; }\n            set\n            {\n                if (value > 59)\n                    throw new ArgumentOutOfRangeException(nameof(LeaseTimeMinutes), \"Lease time in minutes must be between 0 to 59.\");\n\n                _leaseTimeMinutes = value;\n            }\n        }\n\n        public ushort OfferDelayTime\n        {\n            get { return _offerDelayTime; }\n            set { _offerDelayTime = value; }\n        }\n\n        public bool PingCheckEnabled\n        {\n            get { return _pingCheckEnabled; }\n            set { _pingCheckEnabled = value; }\n        }\n\n        public ushort PingCheckTimeout","sourceCodeStart":1892,"sourceCodeEnd":1928,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Dhcp/Scope.cs#L1892-L1928","documentation":"Thrown by the LeaseTimeMinutes setter (byte) when the value exceeds 59. Minutes are a sub-hour component (0..59) of the lease time.","triggerScenarios":"Assigning scope.LeaseTimeMinutes = value where value > 59. Happens when a raw minute count is placed in the minutes field without modular reduction, or a UI omits the bound.","commonSituations":"Decomposing total minutes incorrectly, deserializing seconds into minutes, or a spinner without a 0..59 cap.","solutions":["Clamp or modulo the value to 0..59 before assignment.","When converting a total-minute figure, carry overflow into hours/days: minutes %= 60; hours += totalMinutes / 60.","Validate config so minutes never exceeds 59.","Confirm the field is minutes, not seconds."],"exampleFix":"// before\nscope.LeaseTimeMinutes = (byte)totalMinutes; // throws if > 59\n\n// after\nscope.LeaseTimeMinutes = (byte)(totalMinutes % 60);","handlingStrategy":"validation","validationCode":"if (minutes > 59) throw new ConfigurationException(\"LeaseTimeMinutes must be <= 59\");\nscope.LeaseTimeMinutes = (byte)Math.Clamp(minutes, 0, 59);","typeGuard":"static bool IsValidLeaseTimeMinutes(int minutes) => minutes >= 0 && minutes <= 59;","tryCatchPattern":"try { scope.LeaseTimeMinutes = value; }\ncatch (ArgumentOutOfRangeException ex) when (ex.ParamName == \"LeaseTimeMinutes\")\n{ /* clamp and retry */ }","preventionTips":["Carry minute overflow into hours (total/60).","Bound the minutes spinner to 0..59.","Confirm units: minutes, not seconds."],"tags":["dhcp","validation","scope","lease-time","argument"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}