-{"Data":{"Sdk":{"Events":[{"Id":"10186491951","Type":"IssuesEvent","CreatedAt":"2026-06-02T15:18:42","Actor":"mkaszewiak","Repository":"dotnet/Open-XML-SDK","Organization":"dotnet","RawContent":null,"RelatedAction":"assigned","RelatedUrl":"https://github.com/dotnet/Open-XML-SDK/issues/2091","RelatedDescription":null,"RelatedBody":"**Describe the bug**\nWhen opening a .docx file whose [Content_Types].xml is missing the required <Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/> entry, WordprocessingDocument.MainDocumentPart is null. Any code\n that dereferences it without a null check then throws NullReferenceException.\n\n This is a known real-world OPC spec deviation (ECMA-376 Part 2 §10.1.2) produced by a number of OOXML generators. Word Desktop and other readers recover silently. The SDK does not.\n\n**Screenshots**\nIf applicable, add screenshots to help explain your problem.\n\n**To Reproduce**\n```\n[Fact]\n public void Open_MissingRelsContentType_MainDocumentPartIsNotNull()\n {\n var stream = new MemoryStream();\n using (var zip = new ZipArchive(stream, ZipArchiveMode.Create, leaveOpen: true))\n {\n Write(zip, \"[Content_Types].xml\", \"\"\"\n <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n <Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">\n <Default Extension=\"xml\" ContentType=\"application/xml\"/>\n <Override PartName=\"/word/document.xml\"\n ContentType=\"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml\"/>\n </Types>\n \"\"\");\n Write(zip, \"_rels/.rels\", \"\"\"\n <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n <Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\n <Relationship Id=\"rId1\"\n Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\"\n Target=\"word/document.xml\"/>\n </Relationships>\n \"\"\");\n Write(zip, \"word/document.xml\", \"\"\"\n <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n <w:document xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\">\n <w:body><w:p/></w:body>\n </w:document>\n \"\"\");\n }\n\n stream.Position = 0;\n using var doc = WordprocessingDocument.Open(stream, isEditable: false);\n\n Assert.NotNull(doc.MainDocumentPart); // fails — returns null\n }\n\n static void Write(ZipArchive zip, string name, string content)\n {\n using var w = new StreamWriter(zip.CreateEntry(name).Open());\n w.Write(content);\n }\n```\n\n\n**Observed behavior**\ndoc.MainDocumentPart is null.\n\n**Expected behavior**\nMainDocumentPart should be non-null. The Default Extension=\"rels\" entry is required by the OPC spec but is widely omitted in practice. Word Desktop and other readers tolerate this deviation; the SDK should too.\n\n**Desktop (please complete the following information):**\n - OS: Linux / macOS / Windows (reproducible on all)\n - .NET Target: netstandard2.0, net6.0, net8.0 (all affected)\n - DocumentFormat.OpenXml Version: latest main (9fe57e8)\n\n**Root cause**\n\n System.IO.Packaging is strict about content-type registration. When the Default Extension=\"rels\" entry is absent from [Content_Types].xml, it cannot resolve .rels parts. As a result, PartRelationshipsFeature.LoadReferencedPartsAndRelationships\n finds no internal relationships at the package level and MainDocumentPart comes back null.\n\n**Additional context**\nA fix is proposed in the linked PR. RepairRelsContentType() in StreamPackageFeature detects the missing entry before Package.Open and rebuilds the stream with it injected into [Content_Types].xml. All other ZIP entries are streamed verbatim.\n The repair is a no-op for well-formed packages and falls back silently on any error so Package.Open can still produce its own diagnostics.\nhttps://github.com/dotnet/Open-XML-SDK/pull/2090\n"},{"Id":"10164607313","Type":"IssuesEvent","CreatedAt":"2026-06-02T06:32:40","Actor":"rakeshbabuseva","Repository":"dotnet/Open-XML-SDK","Organization":"dotnet","RawContent":null,"RelatedAction":"opened","RelatedUrl":"https://github.com/dotnet/Open-XML-SDK/issues/2091","RelatedDescription":"Opened issue \"WordprocessingDocument.Open returns null MainDocumentPart when [Content_Types].xml omits Default Extension=\"rels\"\" (#2091) at dotnet/Open-XML-SDK","RelatedBody":"**Describe the bug**\nWhen opening a .docx file whose [Content_Types].xml is missing the required <Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/> entry, WordprocessingDocument.MainDocumentPart is null. Any code\n that dereferences it without a null check then throws NullReferenceException.\n\n This is a known real-world OPC spec deviation (ECMA-376 Part 2 §10.1.2) produced by a number of OOXML generators. Word Desktop and other readers recover silently. The SDK does not.\n\n**Screenshots**\nIf applicable, add screenshots to help explain your problem.\n\n**To Reproduce**\n```\n[Fact]\n public void Open_MissingRelsContentType_MainDocumentPartIsNotNull()\n {\n var stream = new MemoryStream();\n using (var zip = new ZipArchive(stream, ZipArchiveMode.Create, leaveOpen: true))\n {\n Write(zip, \"[Content_Types].xml\", \"\"\"\n <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n <Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">\n <Default Extension=\"xml\" ContentType=\"application/xml\"/>\n <Override PartName=\"/word/document.xml\"\n ContentType=\"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml\"/>\n </Types>\n \"\"\");\n Write(zip, \"_rels/.rels\", \"\"\"\n <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n <Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\n <Relationship Id=\"rId1\"\n Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\"\n Target=\"word/document.xml\"/>\n </Relationships>\n \"\"\");\n Write(zip, \"word/document.xml\", \"\"\"\n <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n <w:document xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\">\n <w:body><w:p/></w:body>\n </w:document>\n \"\"\");\n }\n\n stream.Position = 0;\n using var doc = WordprocessingDocument.Open(stream, isEditable: false);\n\n Assert.NotNull(doc.MainDocumentPart); // fails — returns null\n }\n\n static void Write(ZipArchive zip, string name, string content)\n {\n using var w = new StreamWriter(zip.CreateEntry(name).Open());\n w.Write(content);\n }\n```\n\n\n**Observed behavior**\ndoc.MainDocumentPart is null.\n\n**Expected behavior**\nMainDocumentPart should be non-null. The Default Extension=\"rels\" entry is required by the OPC spec but is widely omitted in practice. Word Desktop and other readers tolerate this deviation; the SDK should too.\n\n**Desktop (please complete the following information):**\n - OS: Linux / macOS / Windows (reproducible on all)\n - .NET Target: netstandard2.0, net6.0, net8.0 (all affected)\n - DocumentFormat.OpenXml Version: latest main (9fe57e8)\n\n**Root cause**\n\n System.IO.Packaging is strict about content-type registration. When the Default Extension=\"rels\" entry is absent from [Content_Types].xml, it cannot resolve .rels parts. As a result, PartRelationshipsFeature.LoadReferencedPartsAndRelationships\n finds no internal relationships at the package level and MainDocumentPart comes back null.\n\n**Additional context**\nA fix is proposed in the linked PR. RepairRelsContentType() in StreamPackageFeature detects the missing entry before Package.Open and rebuilds the stream with it injected into [Content_Types].xml. All other ZIP entries are streamed verbatim.\n The repair is a no-op for well-formed packages and falls back silently on any error so Package.Open can still produce its own diagnostics.\nhttps://github.com/dotnet/Open-XML-SDK/pull/2090\n"},{"Id":"10164597539","Type":"PullRequestEvent","CreatedAt":"2026-06-02T06:32:23","Actor":"rakeshbabuseva","Repository":"dotnet/Open-XML-SDK","Organization":"dotnet","RawContent":null,"RelatedAction":"opened","RelatedUrl":null,"RelatedDescription":"Opened pull request \"\" (#2090) at dotnet/Open-XML-SDK","RelatedBody":null},{"Id":"10009030116","Type":"PullRequestEvent","CreatedAt":"2026-05-28T15:43:31","Actor":"PrzemyslawKlys","Repository":"dotnet/Open-XML-SDK","Organization":"dotnet","RawContent":null,"RelatedAction":"opened","RelatedUrl":null,"RelatedDescription":"Opened pull request \"\" (#2089) at dotnet/Open-XML-SDK","RelatedBody":null}],"ResultType":"GitHubEvent"}},"RunOn":"2026-06-06T03:30:24.6882855Z","RunDurationInMilliseconds":937}
0 commit comments