{"record":{"id":"974fb860073a8f38","repo":"EllanJiang/GameFramework","slug":"name-is-invalid-updatableversionlist-filesystem","errorCode":null,"errorMessage":"Name is invalid.","messagePattern":"Name is invalid\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Resource/UpdatableVersionList.FileSystem.cs","lineNumber":34,"sourceCode":"        /// </summary>\n        [StructLayout(LayoutKind.Auto)]\n        public struct FileSystem\n        {\n            private static readonly int[] EmptyIntArray = new int[] { };\n\n            private readonly string m_Name;\n            private readonly int[] m_ResourceIndexes;\n\n            /// <summary>\n            /// 初始化文件系统的新实例。\n            /// </summary>\n            /// <param name=\"name\">文件系统名称。</param>\n            /// <param name=\"resourceIndexes\">文件系统包含的资源索引集合。</param>\n            public FileSystem(string name, int[] resourceIndexes)\n            {\n                if (name == null)\n                {\n                    throw new GameFrameworkException(\"Name is invalid.\");\n                }\n\n                m_Name = name;\n                m_ResourceIndexes = resourceIndexes ?? EmptyIntArray;\n            }\n\n            /// <summary>\n            /// 获取文件系统名称。\n            /// </summary>\n            public string Name\n            {\n                get\n                {\n                    return m_Name;\n                }\n            }\n\n            /// <summary>","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Resource/UpdatableVersionList.FileSystem.cs#L16-L52","documentation":"The FileSystem class nested in UpdatableVersionList validates the file-system name in its constructor, requiring a non-null string (note: unlike other checks, only null is rejected here, not empty). The name is the key for grouping resources into file systems in the update list. A null name would break resource-to-filesystem mapping, so it throws.","triggerScenarios":"Constructing UpdatableVersionList.FileSystem with a null name, or deserializing an updatable version list whose file-system entry lacks a name field.","commonSituations":"Corrupt or truncated update version file, packaging tool emitting a null file-system name, or a parser reading a null string from malformed binary data.","solutions":["Pass a non-null name to the FileSystem constructor","Regenerate the updatable version list","Fix the deserialization code that yields null names"],"exampleFix":"// before\nnew FileSystem(null, resourceIndexes);\n// after\nif (name == null) throw new ArgumentNullException(nameof(name));\nnew FileSystem(name, resourceIndexes);","handlingStrategy":"validation","validationCode":"if (fileSystemName == null) { Log.Error(\"FileSystem entry missing name\"); return; }","typeGuard":"bool HasFileSystemName(string n) => n != null;","tryCatchPattern":"try { var fs = new FileSystem(name, indexes); } catch (GameFrameworkException ex) when (ex.Message == \"Name is invalid.\") { Log.Error(ex, \"Invalid file system entry in version list\"); }","preventionTips":["Reject null file-system names when building version lists","Checksum and verify update version files before parsing","Keep the packaging tool output format aligned with the runtime parser"],"tags":["resource","version-list","filesystem","constructor"],"backgroundTag":"null-argument","analyzedSha":"d0c010b05167c58e92350449d04864a91ca13fd2","analyzedAt":"2026-09-15T13:37:15.352Z","contentChangedAt":"2026-09-15T13:37:15.352Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}