EllanJiang/GameFramework · error · GameFrameworkException

Verify resource count per frame is invalid.

Error message

Verify resource count per frame is invalid.

What it means

ResourceVerifier.VerifyResources throws this when verifyResourceLengthPerFrame is negative. This parameter bounds how many bytes are verified per frame; a negative value is meaningless and rejected up front as an invalid argument.

Solutions

  1. Pass a non-negative value, e.g. VerifyResources(1024 * 1024) for 1MB per frame.
  2. Clamp the value before calling: verifyResourceLengthPerFrame = Math.Max(0, value).
  3. Fix the config/default that produced the negative number.

Example fix

// before
m_ResourceManager.VerifyResources(userConfig.verifyBytesPerFrame); // may be -1
// after
int bytes = Math.Max(0, userConfig.verifyBytesPerFrame);
m_ResourceManager.VerifyResources(bytes);
Defensive patterns

Strategy: validation

Validate before calling

// C#
if (verifyResourceLengthPerFrame < 0)
{
    throw new ArgumentException("verifyResourceLengthPerFrame must be >= 0", nameof(verifyResourceLengthPerFrame));
}
m_ResourceManager.VerifyResources(verifyResourceLengthPerFrame);

Prevention

When it happens

Trigger: Calling VerifyResources(-1) or passing any negative per-frame byte budget, e.g. from a config value that was mis-parsed or defaulted to -1 as a 'disabled' sentinel.

Common situations: Config files where -1 means 'unlimited' by convention elsewhere but not here; UI sliders that can be dragged below 0; uninitialized int fields defaulting to -1.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.ResourceVerifier.cs:130

            /// </summary>
            public void Shutdown()
            {
                m_VerifyInfos.Clear();
                m_LoadReadWriteVersionListComplete = false;
                m_VerifyResourceLengthPerFrame = 0;
                m_VerifyResourceIndex = 0;
                m_FailureFlag = false;
            }

            /// <summary>
            /// 校验资源。
            /// </summary>
            /// <param name="verifyResourceLengthPerFrame">每帧至少校验资源的大小,以字节为单位。</param>
            public void VerifyResources(int verifyResourceLengthPerFrame)
            {
                if (verifyResourceLengthPerFrame < 0)
                {
                    throw new GameFrameworkException("Verify resource count per frame is invalid.");
                }

                if (m_ResourceManager.m_ResourceHelper == null)
                {
                    throw new GameFrameworkException("Resource helper is invalid.");
                }

                if (string.IsNullOrEmpty(m_ResourceManager.m_ReadWritePath))
                {
                    throw new GameFrameworkException("Read-write path is invalid.");
                }

                m_VerifyResourceLengthPerFrame = verifyResourceLengthPerFrame;
                m_ResourceManager.m_ResourceHelper.LoadBytes(Utility.Path.GetRemotePath(Path.Combine(m_ResourceManager.m_ReadWritePath, LocalVersionListFileName)), new LoadBytesCallbacks(OnLoadReadWriteVersionListSuccess, OnLoadReadWriteVersionListFailure), null);
            }

            private bool VerifyResource(VerifyInfo verifyInfo)
            {

View on GitHub (pinned to d0c010b051)