{"record":{"id":"9c17724335d34355","repo":"EllanJiang/GameFramework","slug":"can-not-load-binary-0-from-file-system-which-is-not-ready","errorCode":null,"errorMessage":"Can not load binary '{0}' from file system which is not ready.","messagePattern":"Can not load binary '(.+?)' from file system which is not ready\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.ResourceLoader.cs","lineNumber":628,"sourceCode":"                }\n            }\n\n            /// <summary>\n            /// 从文件系统中加载二进制资源。\n            /// </summary>\n            /// <param name=\"binaryAssetName\">要加载二进制资源的名称。</param>\n            /// <returns>存储加载二进制资源的二进制流。</returns>\n            public byte[] LoadBinaryFromFileSystem(string binaryAssetName)\n            {\n                ResourceInfo resourceInfo = GetResourceInfo(binaryAssetName);\n                if (resourceInfo == null)\n                {\n                    throw new GameFrameworkException(Utility.Text.Format(\"Can not load binary '{0}' from file system which is not exist.\", binaryAssetName));\n                }\n\n                if (!resourceInfo.Ready)\n                {\n                    throw new GameFrameworkException(Utility.Text.Format(\"Can not load binary '{0}' from file system which is not ready.\", binaryAssetName));\n                }\n\n                if (!resourceInfo.IsLoadFromBinary)\n                {\n                    throw new GameFrameworkException(Utility.Text.Format(\"Can not load binary '{0}' from file system which is not a binary asset.\", binaryAssetName));\n                }\n\n                if (!resourceInfo.UseFileSystem)\n                {\n                    throw new GameFrameworkException(Utility.Text.Format(\"Can not load binary '{0}' from file system which is not use file system.\", binaryAssetName));\n                }\n\n                IFileSystem fileSystem = m_ResourceManager.GetFileSystem(resourceInfo.FileSystemName, resourceInfo.StorageInReadOnly);\n                byte[] bytes = fileSystem.ReadFile(resourceInfo.ResourceName.FullName);\n                if (bytes == null)\n                {\n                    return null;\n                }","sourceCodeStart":610,"sourceCodeEnd":646,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.ResourceLoader.cs#L610-L646","documentation":"LoadBinaryFromFileSystem found the ResourceInfo but resourceInfo.Ready is false — the resource is registered but not yet present locally (still updating). The synchronous file-system read cannot proceed, so it throws a GameFrameworkException.","triggerScenarios":"Calling LoadBinaryFromFileSystem during an in-progress resource update in updatable mode, or after a failed/interrupted download left the resource NotReady.","commonSituations":"Hot-update not finished when gameplay requests the binary; network interruption during update; starting loads immediately after app launch before CheckVersion/UpdateResources completes.","solutions":["Defer the call until the ResourceComponent signals all resources updated/ready.","Poll or await readiness (e.g. check resource state) before reading from the file system.","If the update failed, restart UpdateResources and retry once Ready becomes true.","Wrap in try-catch on GameFrameworkException and fall back to async LoadBinary once update completes."],"exampleFix":"// before\nbyte[] bytes = m_ResourceComponent.LoadBinaryFromFileSystem(binaryName); // during hot-update\n// after\nm_ResourceComponent.ResourceUpdateAllComplete += () =>\n{\n    byte[] bytes = m_ResourceComponent.LoadBinaryFromFileSystem(binaryName);\n};","handlingStrategy":"retry","validationCode":"if (!m_ResourceComponent.IsResourceAllReady)\n{\n    m_ResourceComponent.ResourceUpdateAllComplete += () => ReadBinary(binaryName);\n    return;\n}","typeGuard":"bool IsResourceReady(ResourceComponent rc, string name) => rc != null && rc.IsResourceAllReady;","tryCatchPattern":"try { bytes = m_ResourceComponent.LoadBinaryFromFileSystem(binaryName); }\ncatch (GameFrameworkException ex) when (ex.Message.Contains(\"not ready\"))\n{ DeferUntilUpdateComplete(() => ReadBinary(binaryName)); }","preventionTips":["Suspend gameplay loads until the hot-update pipeline reports completion.","Retry failed updates automatically before serving binary reads.","Show a loading gate during updates so code paths cannot read NotReady resources.","Log update state alongside read failures for diagnosis."],"tags":["gameframework","resource","filesystem","binary","not-ready"],"backgroundTag":"invalid-state-transition","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"}