{"record":{"id":"fe39dc91f0705aa0","repo":"EllanJiang/GameFramework","slug":"record-interval-is-invalid","errorCode":null,"errorMessage":"Record interval is invalid.","messagePattern":"Record interval is invalid\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Download/DownloadManager.DownloadCounter.cs","lineNumber":30,"sourceCode":"        private sealed partial class DownloadCounter\n        {\n            private readonly GameFrameworkLinkedList<DownloadCounterNode> m_DownloadCounterNodes;\n            private float m_UpdateInterval;\n            private float m_RecordInterval;\n            private float m_CurrentSpeed;\n            private float m_Accumulator;\n            private float m_TimeLeft;\n\n            public DownloadCounter(float updateInterval, float recordInterval)\n            {\n                if (updateInterval <= 0f)\n                {\n                    throw new GameFrameworkException(\"Update interval is invalid.\");\n                }\n\n                if (recordInterval <= 0f)\n                {\n                    throw new GameFrameworkException(\"Record interval is invalid.\");\n                }\n\n                m_DownloadCounterNodes = new GameFrameworkLinkedList<DownloadCounterNode>();\n                m_UpdateInterval = updateInterval;\n                m_RecordInterval = recordInterval;\n                Reset();\n            }\n\n            public float UpdateInterval\n            {\n                get\n                {\n                    return m_UpdateInterval;\n                }\n                set\n                {\n                    if (value <= 0f)\n                    {","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Download/DownloadManager.DownloadCounter.cs#L12-L48","documentation":"DownloadCounter's constructor requires a strictly positive record interval — how often the average/max download speed snapshot is recorded. A record interval <= 0 would either never record or divide by zero when computing speed, so the constructor rejects it.","triggerScenarios":"Constructing DownloadCounter with recordInterval <= 0f, e.g. DownloadCounter(1f, 0f) or a negative value from misparsed settings.","commonSituations":"DownloadManager settings asset with Record Interval left at 0, copy-pasted config where the interval was accidentally zeroed, or a unit test passing 0 to skip recording.","solutions":["Pass a positive recordInterval (e.g. 10f seconds)","Fix the DownloadManager settings in the Inspector/config so record interval > 0","If intervals come from remote config, add a floor (Math.Max(1f, value)) before use"],"exampleFix":"// before\nvar counter = new DownloadCounter(updateInterval, 0f);\n// after\nvar counter = new DownloadCounter(updateInterval, Math.Max(1f, recordInterval));","handlingStrategy":"validation","validationCode":"if (recordInterval <= 0f) recordInterval = 10f; // floor before constructing","typeGuard":"bool IsValidInterval(float seconds) => !float.IsNaN(seconds) && seconds > 0f;","tryCatchPattern":"try { var counter = new DownloadCounter(updateInterval, recordInterval); } catch (GameFrameworkException ex) { Log.Error(\"Download counter config invalid: {0}\", ex.Message); }","preventionTips":["Never use 0 to 'disable' recording; use a large interval instead","Validate settings assets in editor scripts","Share one interval-validation utility for all download settings"],"tags":["download","argument-validation","config","unity","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-15T23:17:13.987Z"}