System.NullReferenceException exception in Aspose.Words.Document.Save

We have started getting a NullReferenceException when trying to save a generated document. The document is comprised of data from our system, and also optionally combines in several sub documents. All the documents have only been edited in MS Word, so we do not think they are corrupt.
Exception information:

System.NullReferenceException: Object reference not set to an
instance of an object.
at ෶.ู.ไ(String ՗, BinaryWriter ೞ, Byte ใ)
at ෶.ᝄ.ೝ(BinaryWriter ೞ)
at ෶.ᚓ.ೝ(BinaryWriter ೞ)
at ෶.ᐰ.ೝ(ᐩ ᛨ, BinaryWriter ᜍ)
at ⒂.⒁.⒦()
at ⒂.⒁.⒙()
at ⒂.⒁.⒘(⑹ ⑸)
at Aspose.Words.Document.ࠎ(Stream ؟, String ؖ, SaveFormat ࠏ)
at Aspose.Words.Document.Save(String fileName, SaveFormat fileFormat)
at Aspose.Words.Document.Save(String fileName)

Hello!
Thank you for your interest in Aspose components.
Please attach the problematic document so we could reproduce and spot this issue.
In what format are you saving - DOC?
Regards,

It’s taken me some time to reproduce this in a simple way, without shipping a million lines of code, and a 4Gb database :-).

The simpliest code sample to reproduce this on the latest release (4.4.2.0) is below:

using Aspose.Words;

namespace AsposeCrash
{
    class Program
    {
        static void Main(string[] args)
        {
            Document _doc = new Document();
            DocumentBuilder _builder = new DocumentBuilder(_doc);
            Table _t = _builder.StartTable();
            Cell _c1 = _builder.InsertCell();
            Paragraph _cellParagraph = _builder.InsertParagraph();

            Comment _comment = new Comment(_doc);
            _comment.Author = "Author";
            Paragraph _commentParagraph = new Paragraph(_doc);
            _comment.Paragraphs.Add(_commentParagraph);
            _commentParagraph.Runs.Add(new Run(_doc, "Test"));

            _cellParagraph.AppendChild(_comment);

            Cell _c2 = _builder.InsertCell();
            _builder.EndRow();
            Cell _c3 = _builder.InsertCell();
            Cell _c4 = _builder.InsertCell();
            _builder.EndRow();
            _builder.EndTable();
            _doc.Save(@"c:\temp\crash.doc");

        }
    }
}

This code works fine with the previous version we were using 4.2.6.0.

Hello Tim.
Thank you for your help. I have reproduced this exception with Aspose.Words 4.4.2.0 and logged as #4125 in our defect database. It’s a severe issue (crash) and we’ll definitely try to fix it in the next release, approximately 1-2 weeks. We’ll notify you when it is available.
Best regards,

Hi,
I notice that there is a new version available (4.4.3), if doesn’t mention that this issue is fixed in the notes. Can you tell me if it is fixed in this release, or if not give me an idea of when it will be fixed.

Thanks,

Tim

Hello Tim.
I’m sorry. #4125 hasn’t been fixed in Aspose.Words 4.4.3.0. The issue is still open. We’ll try to include the fix in the next release closer to the end of January. If it is urgent maybe we can transform your code somehow to avoid the exception.
Regards,

The issues you have found earlier (filed as 4125) have been fixed in this update.