Document.Save() Throwing Null Reference Exception

While attempting to convert a document from .docx to .rtf, a call to the Document.Save() operation fails with a Null Reference Exception. I’ve included the stack trace and a snippet of the calling code. Please advise on how to resolve or work around this issue.

Stack Trace:

    at    .(Paragraph )
    at    .VisitParagraphStart(Paragraph )
    at Aspose.Words.Paragraph.r3ka8zscesabkstb24kjjv9sml9wq7pw    (DocumentVisitor )
    at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
    at Aspose.Words.Paragraph.Accept(DocumentVisitor visitor)
    at Aspose.Words.CompositeNode.AcceptChildren(DocumentVisitor visitor)
    at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
    at Aspose.Words.Body.Accept(DocumentVisitor visitor)
    at    .VisitSectionEnd(Section )
    at Aspose.Words.Section.r3ka8zscesabkstb24kjjv9sml9wq7pw    (DocumentVisitor )
    at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
    at Aspose.Words.Section.Accept(DocumentVisitor visitor)
    at Aspose.Words.CompositeNode.AcceptChildren(DocumentVisitor visitor)
    at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
    at Aspose.Words.Document.Accept(DocumentVisitor visitor)
    at    .       (​   )
    at    .       (​   )
    at Aspose.Words.Document.(​   )
    at Aspose.Words.Document.(Stream , String , SaveOptions )
    at Aspose.Words.Document.Save(Stream stream, SaveOptions saveOptions)
    at AsposeSandbox.Program.ConvertToRtf() in \..\source\repos\AsposeSandbox\Program.cs:line 45

Failing Method:

private static byte[] ConvertToRtf()
{
    // The offending file is a .docx document with a 199 revisions.
    var testFileInfo = new FileInfo("TestDocument.docx");

    var stream = new MemoryStream();

    Document doc = new Document(testFileInfo.FullName);

    SaveOptions saveOptions = SaveOptions.CreateSaveOptions(SaveFormat.Rtf);

    // Calling Save() results in an obfuscated Null Object exception.
    doc.Save(stream, saveOptions);

    return stream.ToArray();
}

TestDocument.docx (24.4 KB)

@rcortino
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-25873

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The issues you have found earlier (filed as WORDSNET-25873) have been fixed in this Aspose.Words for .NET 23.10 update also available on NuGet.