{"record":{"id":"81ea16ca884a24f6","repo":"EllanJiang/GameFramework","slug":"resource-helper-is-invalid-resourcemanager-resourceverifier","errorCode":null,"errorMessage":"Resource helper is invalid.","messagePattern":"Resource helper is invalid\\.","errorType":"validation","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.ResourceVerifier.cs","lineNumber":135,"sourceCode":"                m_VerifyResourceLengthPerFrame = 0;\n                m_VerifyResourceIndex = 0;\n                m_FailureFlag = false;\n            }\n\n            /// <summary>\n            /// 校验资源。\n            /// </summary>\n            /// <param name=\"verifyResourceLengthPerFrame\">每帧至少校验资源的大小，以字节为单位。</param>\n            public void VerifyResources(int verifyResourceLengthPerFrame)\n            {\n                if (verifyResourceLengthPerFrame < 0)\n                {\n                    throw new GameFrameworkException(\"Verify resource count per frame is invalid.\");\n                }\n\n                if (m_ResourceManager.m_ResourceHelper == null)\n                {\n                    throw new GameFrameworkException(\"Resource helper is invalid.\");\n                }\n\n                if (string.IsNullOrEmpty(m_ResourceManager.m_ReadWritePath))\n                {\n                    throw new GameFrameworkException(\"Read-write path is invalid.\");\n                }\n\n                m_VerifyResourceLengthPerFrame = verifyResourceLengthPerFrame;\n                m_ResourceManager.m_ResourceHelper.LoadBytes(Utility.Path.GetRemotePath(Path.Combine(m_ResourceManager.m_ReadWritePath, LocalVersionListFileName)), new LoadBytesCallbacks(OnLoadReadWriteVersionListSuccess, OnLoadReadWriteVersionListFailure), null);\n            }\n\n            private bool VerifyResource(VerifyInfo verifyInfo)\n            {\n                if (verifyInfo.UseFileSystem)\n                {\n                    IFileSystem fileSystem = m_ResourceManager.GetFileSystem(verifyInfo.FileSystemName, false);\n                    string fileName = verifyInfo.ResourceName.FullName;\n                    FileSystem.FileInfo fileInfo = fileSystem.GetFileInfo(fileName);","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.ResourceVerifier.cs#L117-L153","documentation":"ResourceVerifier.VerifyResources throws this when the ResourceManager's resource helper has not been set (m_ResourceHelper is null). The verifier needs the helper's LoadBytes method to load the local version list, so verification cannot proceed without it.","triggerScenarios":"Calling VerifyResources before ResourceManager.SetResourceHelper was called, or after it was called with a null/never-assigned helper.","commonSituations":"Initialization order bugs: verification kicked off in Awake/Start before the helper assignment line runs; helper assignment accidentally removed during refactoring; helper set on a different ResourceManager instance than the one verified.","solutions":["Call ResourceManager.SetResourceHelper(new DefaultResourceHelper()) (or your custom helper) before VerifyResources.","Verify initialization order: helper setup must precede the verify call in your startup sequence.","Ensure the helper is set on the same ResourceManager instance used for verification."],"exampleFix":"// before\nm_ResourceManager.VerifyResources(1024 * 1024); // helper not set yet\n// after\nm_ResourceManager.SetResourceHelper(new DefaultResourceHelper());\nm_ResourceManager.VerifyResources(1024 * 1024);","handlingStrategy":"validation","validationCode":"// C#\n// ensure helper is registered before verifying\nm_ResourceManager.SetResourceHelper(new DefaultResourceHelper()); // once, at bootstrap\n// then\nm_ResourceManager.VerifyResources(1024 * 1024);","typeGuard":null,"tryCatchPattern":"// C#\ntry\n{\n    m_ResourceManager.VerifyResources(1024 * 1024);\n}\ncatch (GameFrameworkException ex) when (ex.Message.Contains(\"Resource helper is invalid\"))\n{\n    // fix init order: call SetResourceHelper, then retry verification\n}","preventionTips":["Make SetResourceHelper the first resource-system call in your bootstrap.","Centralize resource-system initialization in one place so ordering cannot drift.","Add a startup assertion that the helper has been set before any verify/update flow."],"tags":["gameframework","resource-verifier","missing-dependency","initialization-order"],"backgroundTag":"missing-dependency","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"}