EllanJiang/GameFramework · error · GameFrameworkException

Check resources complete callback is invalid.

Error message

Check resources complete callback is invalid.

What it means

Thrown by ResourceManager.CheckResources when the checkResourcesCompleteCallback parameter is null. CheckResources needs the callback to deliver the result of comparing local resources against the version list, so it rejects a null delegate up front.

Solutions

  1. Pass a non-null CheckResourcesCompleteCallback implementation.
  2. Verify the delegate variable is assigned before the call.
  3. Catch GameFrameworkException to catch the bad call during development.

Example fix

// before
m_ResourceManager.CheckResources(ignoreOtherVariant, null);
// after
m_ResourceManager.CheckResources(ignoreOtherVariant, OnCheckResourcesComplete);

private void OnCheckResourcesComplete(int removedCount, int updateCount, int updateLength, long updateLengthBytes) { ... }
Defensive patterns

Strategy: retry

Validate before calling

// defer until the current operation completes
if (m_UpdateOperationInProgress) {
    m_PendingVerify = () => m_ResourceManager.VerifyResources(len, cb);
    return;
}
m_ResourceManager.VerifyResources(len, cb);

Try / catch

try { m_ResourceManager.VerifyResources(len, cb); } catch (GameFrameworkException ex) { QueueVerifyForAfterCurrentOperation(); }

Prevention

When it happens

Trigger: Calling CheckResources(bool, CheckResourcesCompleteCallback) with null, e.g. m_ResourceManager.CheckResources(false, null) or passing a variable that was never assigned.

Common situations: Removing the completion handler during refactoring; forgetting to subscribe in the update flow; a null-returning factory for the handler.

Related errors


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

Appendix: source

Thrown at GameFramework/Resource/ResourceManager.cs:1219

            m_ResourceVerifier = new ResourceVerifier(this);
            m_ResourceVerifier.ResourceVerifyStart += OnVerifierResourceVerifyStart;
            m_ResourceVerifier.ResourceVerifySuccess += OnVerifierResourceVerifySuccess;
            m_ResourceVerifier.ResourceVerifyFailure += OnVerifierResourceVerifyFailure;
            m_ResourceVerifier.ResourceVerifyComplete += OnVerifierResourceVerifyComplete;
            m_VerifyResourcesCompleteCallback = verifyResourcesCompleteCallback;
            m_ResourceVerifier.VerifyResources(verifyResourceLengthPerFrame);
        }

        /// <summary>
        /// 使用可更新模式并检查资源。
        /// </summary>
        /// <param name="ignoreOtherVariant">是否忽略处理其它变体的资源,若不忽略,将会移除其它变体的资源。</param>
        /// <param name="checkResourcesCompleteCallback">使用可更新模式并检查资源完成时的回调函数。</param>
        public void CheckResources(bool ignoreOtherVariant, CheckResourcesCompleteCallback checkResourcesCompleteCallback)
        {
            if (checkResourcesCompleteCallback == null)
            {
                throw new GameFrameworkException("Check resources complete callback is invalid.");
            }

            if (m_ResourceMode == ResourceMode.Unspecified)
            {
                throw new GameFrameworkException("You must set resource mode first.");
            }

            if (m_ResourceMode != ResourceMode.Updatable && m_ResourceMode != ResourceMode.UpdatableWhilePlaying)
            {
                throw new GameFrameworkException("You can not use CheckResources without updatable resource mode.");
            }

            if (m_ResourceChecker == null)
            {
                throw new GameFrameworkException("You can not use CheckResources at this time.");
            }

            m_RefuseSetFlag = true;

View on GitHub (pinned to d0c010b051)