{"record":{"id":"9dc15616ed752d51","repo":"EllanJiang/GameFramework","slug":"dependency-assets-is-invalid","errorCode":null,"errorMessage":"Dependency assets is invalid.","messagePattern":"Dependency assets is invalid\\.","errorType":"validation","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/ResourceManager.ResourceLoader.AssetObject.cs","lineNumber":49,"sourceCode":"                    m_ResourceHelper = null;\n                    m_ResourceLoader = null;\n                }\n\n                public override bool CustomCanReleaseFlag\n                {\n                    get\n                    {\n                        int targetReferenceCount = 0;\n                        m_ResourceLoader.m_AssetDependencyCount.TryGetValue(Target, out targetReferenceCount);\n                        return base.CustomCanReleaseFlag && targetReferenceCount <= 0;\n                    }\n                }\n\n                public static AssetObject Create(string name, object target, List<object> dependencyAssets, object resource, IResourceHelper resourceHelper, ResourceLoader resourceLoader)\n                {\n                    if (dependencyAssets == null)\n                    {\n                        throw new GameFrameworkException(\"Dependency assets is invalid.\");\n                    }\n\n                    if (resource == null)\n                    {\n                        throw new GameFrameworkException(\"Resource is invalid.\");\n                    }\n\n                    if (resourceHelper == null)\n                    {\n                        throw new GameFrameworkException(\"Resource helper is invalid.\");\n                    }\n\n                    if (resourceLoader == null)\n                    {\n                        throw new GameFrameworkException(\"Resource loader is invalid.\");\n                    }\n\n                    AssetObject assetObject = ReferencePool.Acquire<AssetObject>();","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/ResourceManager.ResourceLoader.AssetObject.cs#L31-L67","documentation":"Static AssetObject.Create validates that the dependencyAssets list argument is non-null before creating an asset object. A null list cannot represent 'no dependencies' — callers must pass an empty list instead. This is a fail-fast argument guard inside ResourceManager's resource loader.","triggerScenarios":"Calling ResourceManager.LoadAsset (or ResourceLoader.LoadAsset) with dependencyAssets == null, or custom loader code calling AssetObject.Create directly with a null list.","commonSituations":"Custom load pipelines that compute dependency lists conditionally and assign null when none exist instead of an empty List<object>; wrappers around LoadAsset forwarding a null parameter.","solutions":["Pass a non-null (possibly empty) List<object> for dependencyAssets.","Fix your wrapper so it converts null to new List<object>() before calling the API.","If dependencies are computed dynamically, initialize the list before any early-return path."],"exampleFix":"// before\nm_ResourceManager.LoadAsset(assetName, typeof(GameObject), onLoad, null); // null dependency list\n// after\nm_ResourceManager.LoadAsset(assetName, typeof(GameObject), onLoad, new List<object>());","handlingStrategy":"validation","validationCode":"if (dependencyAssets == null) dependencyAssets = new List<object>();","typeGuard":"bool HasDependencyList(List<object> deps) => deps != null;","tryCatchPattern":null,"preventionTips":["Never pass null where an empty list is acceptable.","Initialize dependency lists at declaration time.","Wrap LoadAsset in a helper that normalizes null collections."],"tags":["argument-validation","resource","gameframework"],"backgroundTag":"null-argument","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"}