Unable to Save DOCX: NullReferenceException

Hello,

We are receiving an error when attempting to save a DOCX.

OS version: Windows 10 Pro (Version: 21H2, OS build: 19044.1706)
Target framework: .NET Framework 4.7.1
Aspose.Words version: 19.8.0.0

content file: sample (51.5 KB)
error message: “System.NullReferenceException: ‘Object reference not set to an instance of an object.’”
stack trace: “… doc.Save(inFile, pdfOptions)”
code: …

Dim doc As Aspose.Words.Document = New Aspose.Words.Document(oFile.FilePath & fileContent.FileName)
Dim inFile As String = oFile.FilePath & fileContent.FileName + ".pdf"
Dim pdfOptions As New Aspose.Words.Saving.PdfSaveOptions()
pdfOptions.PageCount = 5
doc.Save(inFile, pdfOptions)

Do you have any suggestions on how we can resolve this issue? Additionally, can you let us know what in the content file is causing this error?

Thank you!

@kmanol Unfortunately, I cannot reproduce the problem on my side. I tested with both 19.8 version and the latest 22.5 version of Aspose.Words for .NET. With both versions the attached document is converted without any exception.
Could you please create a simple console application that will allow us to reproduce the problem? We will check the issue and provide you more information.