{"record":{"id":"1192210cbd1f8c64","repo":"stride3d/stride","slug":"central-directory-currently-does-not-exist","errorCode":null,"errorMessage":"Central directory currently does not exist","messagePattern":"Central directory currently does not exist","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.IO/System.IO.Compression.Zip/ZipFile.cs","lineNumber":416,"sourceCode":"            inStream.Read(buffer, 0, buffer.Length);\n\n            if (zfe.Method == Compression.Deflate)\n                inStream.Dispose();\n\n            return true;\n        }\n\n        /// <summary>\n        /// Read all the file records in the central directory \n        /// </summary>\n        /// <returns>\n        /// List of all entries in directory.\n        /// </returns>\n        public ZipFileEntry[] GetAllEntries()\n        {\n            if (this.centralDirImage == null)\n            {\n                throw new InvalidOperationException(\"Central directory currently does not exist\");\n            }\n\n            var result = new List<ZipFileEntry>();\n\n            int pointer = 0;\n            while (pointer < this.centralDirImage.Length)\n            {\n                uint signature = BitConverter.ToUInt32(this.centralDirImage, pointer);\n                if (signature != 0x02014b50)\n                {\n                    break;\n                }\n\n                result.Add(this.GetEntry(ref pointer));\n            }\n\n            return result.ToArray();\n        }","sourceCodeStart":398,"sourceCodeEnd":434,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.IO/System.IO.Compression.Zip/ZipFile.cs#L398-L434","documentation":"GetAllEntries iterates the cached central-directory image, which only exists after the archive's central directory was successfully read during construction. If centralDirImage is null, the archive is invalid or uninitialized and enumeration cannot proceed.","triggerScenarios":"Calling GetAllEntries on a ZipFile instance whose ReadFileInfo failed or whose underlying stream was empty/corrupt, or on an archive truncated mid-download.","commonSituations":"Partially downloaded zip files, zero-byte placeholder files, or reusing a ZipFile after the underlying stream was disposed/reset.","solutions":["Validate the zip file (signature, size) before opening; re-download if truncated","Recreate the ZipFile over a fresh, complete stream","Wrap construction and GetAllEntries in a check that the constructor succeeded (no swallowed exceptions)"],"exampleFix":"// before\nvar zip = GetCachedZip(); // may have failed init\nvar entries = zip.GetAllEntries();\n// after\nif (zip == null || zip.GetAllEntriesOrNull() == null) throw new InvalidDataException(\"Archive is corrupt\");\nvar entries = zip.GetAllEntries();","handlingStrategy":"try-catch","validationCode":"if (new FileInfo(zipPath).Length == 0) throw new InvalidDataException(\"Zip file is empty\");","typeGuard":null,"tryCatchPattern":"try { entries = zip.GetAllEntries(); }\ncatch (InvalidOperationException) { throw new InvalidDataException($\"Archive {zipPath} is corrupt or truncated\"); }","preventionTips":["Verify file size/signature before constructing ZipFile","Re-download or re-copy incomplete archives","Always build ZipFile from a fully written/flushed stream"],"tags":["zip","corrupt-archive","io"],"backgroundTag":"file-read-failed","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}