Aspose.Word thowing FileCorruptedException

I’m trying to open a word document and I’m getting the exception below. Note that the attached document is blank document, I have removed all the data from the document. And I’m still getting exception. I’m using version 11.1.0.0

Aspose.Words.FileCorruptedException was unhandled by user code
HResult=-2146233088
Message=The document appears to be corrupted and cannot be loaded.
Source=Aspose.Words
StackTrace:
at Aspose.Words.Document.x5d4db34d48fb3129(Stream xcf18e5243f8d5fd3, LoadOptions x27aceb70372bde46)
at Aspose.Words.Document.x5d95f5f98c940295(Stream xcf18e5243f8d5fd3, LoadOptions x27aceb70372bde46)
at Aspose.Words.Document..ctor(Stream stream, LoadOptions loadOptions)
at Aspose.Words.Document..ctor(Stream stream)
at XXXXXX
InnerException: System.NullReferenceException
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=Aspose.Words
StackTrace:
at xda075892eccab2ad.xc1b08afa36bf580c.xa9aaee2edd3cd025(String x971e83bc97861294, Byte[] xf9a0d04800d70471, Int32 x10aaa7cdfa38f254)
at x79490184cecf12a1.xc37fee571c29ba92.xdafccb198ba91439()
at x79490184cecf12a1.xc37fee571c29ba92.x2506b757d67702ec()
at x79490184cecf12a1.xc37fee571c29ba92.x902b6f807c71becd(x3dabda6865ed239d x8ad4cdceb54e447f)
at x79490184cecf12a1.xc37fee571c29ba92.xd4c5b858945b0ab2(x3dabda6865ed239d x8ad4cdceb54e447f)
at x79490184cecf12a1.xc37fee571c29ba92.x06b0e25aa6ad68a9(xa52ef41af20225f0 xe134235b3526fa75)
at x79490184cecf12a1.xa52ef41af20225f0.DoRead()
at x79490184cecf12a1.x11e1346c12ead315.x06b0e25aa6ad68a9()
at x79490184cecf12a1.xae13d15563a3a703.x748a2047fcb706ad()
at x79490184cecf12a1.xae13d15563a3a703.x06b0e25aa6ad68a9()
at Aspose.Words.Document.x5d4db34d48fb3129(Stream xcf18e5243f8d5fd3, LoadOptions x27aceb70372bde46)
InnerException:

Here is the code


public void Test()
{
using (var fs = new FileStream("Test.docx", FileMode.Open, FileAccess.Read))
{
using (var output = new FileStream("output.pdf", FileMode.Create, FileAccess.Write))
{
Aspose.Words.Document wordDocument = new Aspose.Words.Document(fs);
wordDocument.Save(output, Aspose.Words.SaveFormat.Pdf);
}
}
}

Hi,


Thanks for your inquiry. After an initial test with Aspose.Words 13.9.0, I was unable to reproduce this exception on my side. I would suggest you please upgrade to the latest version of Aspose.Words. You can download it from the following link:

I hope, this helps.

Best regards,

Hi

Thanks for your reply. Can you test using the version 11.1.0.0?
Updating assembly is time consuming task, because we have built enterprise application and one of the core functionality built using Aspose. If we update the assembly ( which is easy ) then we also have to do regression testing wherever Aspose is been used. ( which is time & resource consuming)




Hi,


Thanks for your inquiry.

I checked your document with Aspose.Words 11.1.0 on my side. Yes, you’re right; it throws FileCorruptedException during loading your document into it’s DOM. But, unfortunately, we don’t provide support for older released versions of Aspose.Words. We encourage you to use the latest version of Aspose.Words as it contains newly introduced features, enhancements and fixes to the issues that were reported earlier. So, I would suggest you please upgrade to the latest version of Aspose.Words.

Please also note that we exercise “unit testing” and all of our unit tests are properly structured. Therefore, upgrading to the latest version of Aspose.Words is safe and it should cause no undesired behaviour. Since all Aspose.Words functionality is unit tested so everything in the previous versions shall still be working in the newer versions.

If we can help you with anything else, please feel free to ask.

Best regards,