"Object reference not set to an instance of an object" error when Saving Word Document (to a MemoryStream)

Hi,
We are seeing errors in our production environment whenever we try to save an Aspose Word Document object - in order to return a MemoryStream object and then convert that MemoryStream to an array of bytes. This is so we can use that array of bytes in an API call.

The error we are seeing is “Object reference not set to an instance of an object” and we can see from the stack trace that the error occurs within Aspose code itself (please see attached screenshot)

image.png (19.8 KB)

Screenshot of code that leads to the error:
image.png (9.1 KB)

The strange thing is that we cannot reproduce the error in a standalone test application.

Based on the Aspose methods being called in the stack trace screenshot, would you have any suggestions of what may potentially be causing the issue in Aspose in our production environment?

Thanks

@frlspr Unfortunately stack trace is not enough to investigate the issue. Please try to reproduce the exception in standalone application. Maybe some other operations have been performed on the document before saving in production environment?

Hi, We have tried to reproduce with the standalone application and the same Word document. We’ve also tried in other environments unsuccessfully.
If we can enable remote debugging on our Prod server, is there a version of Aspose.Words which we can debug?
We need more information regarding the elements in the document that the Aspose code is examining, when the exception occurs.

@frlspr We do not provide debug versions of Aspose.Words. According to the stack trace the exception is related to the shape processing but it is not possible to say anything more particular. Maybe you could try to cut down the problematic document to determine the node or a range of nodes which causes the exception?