EllanJiang/GameFramework · error · GameFrameworkException

Apply resources ' ' with exception ' '.

Error message

Apply resources '{0}' with exception '{1}'.

What it means

ApplyResources failed while applying a downloaded resource pack to the local resource store. The ResourceManager disposes the partially-applied resource pack stream and throws a GameFrameworkException wrapping the original exception (e.g. IO or checksum failure). The inner exception contains the root cause.

Solutions

  1. Inspect the inner exception (the second argument of GameFrameworkException) to find the root cause (IO error, disk space, corrupt data).
  2. Delete the resource pack file and re-download it, verifying checksum/length after download before calling ApplyResources.
  3. Ensure sufficient free disk space and that no other process holds the file open, then retry ApplyResources.
  4. Wrap the apply step so a failed pack is discarded and the app falls back to normal per-resource updating.

Example fix

// before
resourceManager.ApplyResources(corruptedPackPath);
// after
if (VerifyPackChecksum(corruptedPackPath, expectedHash))
{
    try { resourceManager.ApplyResources(corruptedPackPath); }
    catch (GameFrameworkException ex) { File.Delete(corruptedPackPath); Log.Warning("Pack apply failed, re-download: {0}", ex.InnerException); }
}
else { File.Delete(corruptedPackPath); }
Defensive patterns

Strategy: try-catch

Validate before calling

if (!File.Exists(packPath) || new FileInfo(packPath).Length != expectedLength) { reDownloadPack(); }

Try / catch

try { resourceManager.ApplyResources(packPath); }
catch (GameFrameworkException ex)
{
    Log.Error("Apply pack '{0}' failed: {1}", packPath, ex.InnerException?.Message);
    File.Delete(packPath); // discard bad pack and re-download
}

Prevention

When it happens

Trigger: Calling ApplyResources(resourcePackPath) when reading or copying the resource pack stream throws: corrupted pack file, deleted/moved file mid-apply, disk full, or a stream read error during the apply operation.

Common situations: An interrupted download left a truncated resource pack; the file was modified between download and apply; the device ran out of storage during apply; antivirus or another process locked the file.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15). Data as JSON: /api/errors/63553a6e56a2b5c7. Report an issue: GitHub.

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.ResourceUpdater.cs:394

                            totalLength += resource.Length;
                            m_ApplyWaitingInfo.Enqueue(new ApplyInfo(resourceName, updateInfo.FileSystemName, (LoadType)resource.LoadType, resource.Offset, resource.Length, resource.HashCode, resource.CompressedLength, resource.CompressedHashCode, updateInfo.ResourcePath));
                        }
                    }

                    if (ResourceApplyStart != null)
                    {
                        ResourceApplyStart(m_ApplyingResourcePackPath, m_ApplyWaitingInfo.Count, totalLength);
                    }
                }
                catch (Exception exception)
                {
                    if (m_ApplyingResourcePackStream != null)
                    {
                        m_ApplyingResourcePackStream.Dispose();
                        m_ApplyingResourcePackStream = null;
                    }

                    throw new GameFrameworkException(Utility.Text.Format("Apply resources '{0}' with exception '{1}'.", resourcePackPath, exception), exception);
                }
            }

            /// <summary>
            /// 更新指定资源组的资源。
            /// </summary>
            /// <param name="resourceGroup">要更新的资源组。</param>
            public void UpdateResources(ResourceGroup resourceGroup)
            {
                if (m_DownloadManager == null)
                {
                    throw new GameFrameworkException("You must set download manager first.");
                }

                if (!m_CheckResourcesComplete)
                {
                    throw new GameFrameworkException("You must check resources complete first.");
                }

View on GitHub (pinned to d0c010b051)