{"record":{"id":"e5402ad40829b44d","repo":"EllanJiang/GameFramework","slug":"data-table-helper-is-invalid","errorCode":null,"errorMessage":"Data table helper is invalid.","messagePattern":"Data table helper is invalid\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/DataTable/DataTableManager.cs","lineNumber":115,"sourceCode":"        public void SetDataProviderHelper(IDataProviderHelper<DataTableBase> dataProviderHelper)\n        {\n            if (dataProviderHelper == null)\n            {\n                throw new GameFrameworkException(\"Data provider helper is invalid.\");\n            }\n\n            m_DataProviderHelper = dataProviderHelper;\n        }\n\n        /// <summary>\n        /// 设置数据表辅助器。\n        /// </summary>\n        /// <param name=\"dataTableHelper\">数据表辅助器。</param>\n        public void SetDataTableHelper(IDataTableHelper dataTableHelper)\n        {\n            if (dataTableHelper == null)\n            {\n                throw new GameFrameworkException(\"Data table helper is invalid.\");\n            }\n\n            m_DataTableHelper = dataTableHelper;\n        }\n\n        /// <summary>\n        /// 确保二进制流缓存分配足够大小的内存并缓存。\n        /// </summary>\n        /// <param name=\"ensureSize\">要确保二进制流缓存分配内存的大小。</param>\n        public void EnsureCachedBytesSize(int ensureSize)\n        {\n            DataProvider<DataTableBase>.EnsureCachedBytesSize(ensureSize);\n        }\n\n        /// <summary>\n        /// 释放缓存的二进制流。\n        /// </summary>\n        public void FreeCachedBytes()","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/DataTable/DataTableManager.cs#L97-L133","documentation":"Thrown by DataTableManager.SetDataTableHelper when the supplied IDataTableHelper is null. The helper creates DataTableBase instances by type, so a null value breaks the whole data table module and is rejected at setup time.","triggerScenarios":"Calling SetDataTableHelper(null), or passing a helper variable that was never assigned.","commonSituations":"Game entry code missing the helper registration step; refactor deleted the instantiation; wrong component wired in the framework startup list.","solutions":["Construct a concrete IDataTableHelper implementation and pass it.","Add the SetDataTableHelper call to the standard framework initialization sequence.","Check the helper instantiation for null-returning factory calls."],"exampleFix":"// before\ndataTableManager.SetDataTableHelper(null);\n// after\nm_DataTableHelper = new DataTableHelper();\ndataTableManager.SetDataTableHelper(m_DataTableHelper);","handlingStrategy":"type-guard","validationCode":"if (helper != null) dataTableManager.SetDataTableHelper(helper);","typeGuard":"bool IsValidTableHelper(IDataTableHelper h) => h != null;","tryCatchPattern":"try { dataTableManager.SetDataTableHelper(helper); } catch (GameFrameworkException ex) when (ex.Message.Contains(\"Data table helper\")) { /* register helper */ }","preventionTips":["Include SetDataTableHelper in the standard game entry initialization","Do not delete helper instantiation during refactors","Fail fast at startup if any required helper is null"],"tags":["csharp","datatable","initialization","null-argument"],"backgroundTag":"null-argument","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"}