{"record":{"id":"8b5667a93ae01c74","repo":"EllanJiang/GameFramework","slug":"you-can-not-use-generatereadwriteversionlistlength-at-this","errorCode":null,"errorMessage":"You can not use GenerateReadWriteVersionListLength at this time.","messagePattern":"You can not use GenerateReadWriteVersionListLength at this time\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.cs","lineNumber":326,"sourceCode":"            {\n                m_UpdatePrefixUri = value;\n            }\n        }\n\n        /// <summary>\n        /// 获取或设置每更新多少字节的资源，重新生成一次版本资源列表。\n        /// </summary>\n        public int GenerateReadWriteVersionListLength\n        {\n            get\n            {\n                return m_ResourceUpdater != null ? m_ResourceUpdater.GenerateReadWriteVersionListLength : 0;\n            }\n            set\n            {\n                if (m_ResourceUpdater == null)\n                {\n                    throw new GameFrameworkException(\"You can not use GenerateReadWriteVersionListLength at this time.\");\n                }\n\n                m_ResourceUpdater.GenerateReadWriteVersionListLength = value;\n            }\n        }\n\n        /// <summary>\n        /// 获取正在应用的资源包路径。\n        /// </summary>\n        public string ApplyingResourcePackPath\n        {\n            get\n            {\n                return m_ResourceUpdater != null ? m_ResourceUpdater.ApplyingResourcePackPath : null;\n            }\n        }\n\n        /// <summary>","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.cs#L308-L344","documentation":"The ResourceManager.GenerateReadWriteVersionListLength property setter throws this when m_ResourceUpdater is null. The updater (and with it this setting) only exists after the resource system enters update mode (e.g. SetResourceMode with update enabled); before that there is nothing to configure.","triggerScenarios":"Setting GenerateReadWriteVersionListLength at startup before the resource updater has been created by the resource system's initialization/mode switch.","commonSituations":"Config scripts that apply all ResourceManager settings up front, including update-only settings, in non-update resource modes; settings applied before SetResourceMode(ResourceMode.Package/Updatable...).","solutions":["Set the property only after entering an update mode where the ResourceUpdater exists (after the updater has been created by the resource system's init).","Skip the setting when the game runs in non-updatable resource modes.","Wrap the setter in a null/state check on your side and defer the assignment until the updater is available."],"exampleFix":"// before\nm_ResourceManager.GenerateReadWriteVersionListLength = 1024 * 1024; // updater not created yet\n// after\nif (m_ResourceManager.ResourceMode == ResourceMode.Updatable)\n{\n    m_ResourceManager.GenerateReadWriteVersionListLength = 1024 * 1024;\n}","handlingStrategy":"validation","validationCode":"// C#\nif (m_ResourceManager.ResourceMode == ResourceMode.Updatable)\n{\n    m_ResourceManager.GenerateReadWriteVersionListLength = 1024 * 1024;\n}","typeGuard":null,"tryCatchPattern":"// C#\ntry\n{\n    m_ResourceManager.GenerateReadWriteVersionListLength = value;\n}\ncatch (GameFrameworkException ex) when (ex.Message.Contains(\"GenerateReadWriteVersionListLength\"))\n{\n    // defer setting until update mode is active\n}","preventionTips":["Only apply update-related settings after the resource updater exists (update mode active).","Split startup config into 'always' and 'update-only' groups.","When defaults fail, move the assignment to the point where update mode is initialized."],"tags":["gameframework","resource-manager","wrong-lifecycle-phase","property-setter"],"backgroundTag":"unsupported-operation","analyzedSha":"d0c010b05167c58e92350449d04864a91ca13fd2","analyzedAt":"2026-09-15T13:37:15.352Z","contentChangedAt":"2026-09-15T13:37:15.352Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}