We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error Updating document and saving to docX: System.NullReferenceException

I have a document (attached) that a client of my is attempting to update and resave. The Save method in Aspose is failing on the document when saving to .Docx. If I change the saveformat to .Doc it works, but that was only for testing their problem, it is not an option for them.The file appears to open without incident, but using the following code:

Aspose.Words.Document asposeDoc;

FileInfo file = new FileInfo(inputFile);
MemoryStream output = new MemoryStream();
using (FileStream stream = file.OpenRead()) {
asposeDoc = new Aspose.Words.Document(stream);
asposeDoc.Save(output, SaveFormat.Docx);

I get the following error.

Inner Exception Type: System.NullReferenceException
Inner Exception: Object reference not set to an instance of an object.
Inner Source: Aspose.Words
Inner Stack Trace: at xa8550ea6ae4a81a5.xef6e2bd6ea405b49.xb3bdeab732951a66(VariableCollection x7c97c8b1642837f7, x873451caae5ad4ae xd07ce4b74c5774a7)
at xa8550ea6ae4a81a5.xef6e2bd6ea405b49.x6210059f049f0d48(xaf66e8c590b2b553 xbdfb620b7167944b)
at xa8550ea6ae4a81a5.xaf66e8c590b2b553.x6210059f049f0d48()
at xa8550ea6ae4a81a5.xe41cdb7a2a4611b4.xe3d2f5ee6867cec8()
at xa8550ea6ae4a81a5.xe41cdb7a2a4611b4.x8cac5adfe79bc025(x8556eed81191af11 x5ac1382edb7bf2c2)
at Aspose.Words.Document.xf381a641001e6830(Stream xcf18e5243f8d5fd3, String xafe2f3653ee64ebc, SaveOptions xc27f01f21f67608c)
at Aspose.Words.Document.Save(Stream stream, SaveOptions saveOptions)
at Aspose.Words.Document.Save(Stream stream, SaveFormat saveFormat) Inner Exception Type: System.NullReferenceException

BTW - I have just updated to the newest Aspose.Words.dll as of this morning and the results are the same: this particular file fails to save.

If there is anything I can do to help with this issue, please let me know, as the client is aggressively trying to get this resolved.

Also, if there is something at a particular point in the document that is damaged, please let me know. They have at least 5 documents that show this issue, and if it's something I can do to the document, I'd like to know that as well.

Hi James,

Thanks for your inquiry.
While using latest Aspose.Words 10.8 ( .NET 2.0 ), i could not reproduce this issue on my end. I have also attached output word document file. In case of any ambiguity, please let me know.

That’s strange. I just downloaded and installed, but checking my .dll it says that it is 10.6.

I will ensure that I get updated to the latest and verify that it works.
Hi James,

Thanks for your further details.
To download latest version of Aspose.Words 10.8, please follow up the link below:


In case of any ambiguity, please let me know.

Yes, I had downloaded the right version, but not updated the file in my project properly. It works fine now. Thank you for your great product and service!

Hi James,

Thank you very much for your feedback. It is great to hear that your issue has been resolved. You are always welcome and please feel free to ask if you have any query in future.