{"record":{"id":"fd2b9d5e53186130","repo":"EllanJiang/GameFramework","slug":"expiretime-is-invalid","errorCode":null,"errorMessage":"ExpireTime is invalid.","messagePattern":"ExpireTime is invalid\\.","errorType":"validation","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/ObjectPool/ObjectPoolManager.ObjectPool.cs","lineNumber":158,"sourceCode":"                    Release();\n                }\n            }\n\n            /// <summary>\n            /// 获取或设置对象池对象过期秒数。\n            /// </summary>\n            public override float ExpireTime\n            {\n                get\n                {\n                    return m_ExpireTime;\n                }\n\n                set\n                {\n                    if (value < 0f)\n                    {\n                        throw new GameFrameworkException(\"ExpireTime is invalid.\");\n                    }\n\n                    if (ExpireTime == value)\n                    {\n                        return;\n                    }\n\n                    m_ExpireTime = value;\n                    Release();\n                }\n            }\n\n            /// <summary>\n            /// 获取或设置对象池的优先级。\n            /// </summary>\n            public override int Priority\n            {\n                get","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/ObjectPool/ObjectPoolManager.ObjectPool.cs#L140-L176","documentation":"ExpireTime controls how long unused objects stay in the pool before auto-release; a negative duration is meaningless, so the ExpireTime setter throws. Valid values are zero or positive seconds (0 meaning no auto-expiry, depending on pool settings).","triggerScenarios":"Assigning objectPool.ExpireTime = -1f, usually from a bad config value, a float parse of a negative setting, or a miscomputed duration (endTime - startTime with inverted operands).","commonSituations":"Negative values in pool configuration files; unit mistakes (treating the value as milliseconds or computing it from timestamps in the wrong order); serialized fields corrupted by hand-editing.","solutions":["Set ExpireTime to a non-negative float (seconds)","Clamp before assigning: MathF.Max(0f, value)","Fix the config or computation producing the negative duration"],"exampleFix":"// before\npool.ExpireTime = config.ExpireSeconds; // -5f from bad config\n// after\npool.ExpireTime = Mathf.Max(0f, config.ExpireSeconds);","handlingStrategy":"validation","validationCode":"if (expireTime < 0f) expireTime = 0f;\npool.ExpireTime = expireTime;","typeGuard":"bool IsValidExpireTime(float t) => !float.IsNaN(t) && t >= 0f;","tryCatchPattern":"try { pool.ExpireTime = expireTime; }\ncatch (GameFrameworkException ex) { Log.Error(\"Invalid ExpireTime {0}\", expireTime); }","preventionTips":["Validate duration config fields at load","Watch timestamp subtraction order when computing durations","Confirm units (seconds vs milliseconds) in configs"],"tags":["objectpool","expire-time","validation","gameframework"],"backgroundTag":"invalid-config-value","analyzedSha":"d0c010b05167c58e92350449d04864a91ca13fd2","analyzedAt":"2026-09-15T13:37:15.352Z","contentChangedAt":"2026-09-15T13:37:15.352Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}