Aspose.Cells for .NET fails to save workbook to disk

Hello, I’d like to report a bug we’re seeing when attempting to save a workbook to disk using Aspose.Cells for .NET.

Summary

If a workbook is opened and then cloned in memory using Workbook.Copy(), saving the cloned workbook object to disk with Workbook.Save() will not work; the call will freeze and block forever, leaving a corrupt file on disk. This only occurs with some workbooks, and the bug seems to have been introduced in Aspose.Cells 21.1.0.

Detailed Reproduction

Workbook: AZZ AZZ US.zip (535.8 KB)

I can reliably reproduce the issue on Aspose.Cells 21.4.0 with this code:

// Load workbook and save a copy to disk, this succeeds
var wb = new Aspose.Cells.Workbook(@"C:\scratch\AZZ AZZ US.xlsx");
wb.Save(@"C:\scratch\output1.xlsx", Aspose.Cells.SaveFormat.Auto);

// Clone the original workbook in memory
var clonedWb = new Aspose.Cells.Workbook();
clonedWb.Copy(wb);

// Attempt to save the cloned workbook to disk, this call blocks forever and leaves a corrupted workbook on disk!
clonedWb.Save(@"C:\scratch\output2.xlsx", Aspose.Cells.SaveFormat.Auto);

I used .NET 5 for this reproduction but we’ve seen the issue on .NET Framework 4.8 as well. I did some testing with older versions of Aspose, and it seems like versions 20.12.0 and earlier are not affected by this bug.

Only some of our workbooks trigger this bug; I have not been able to identify a pattern.

Thank you in advance, and just let me know if you need any additional information!

Legal Stuff

Canalyst considers the Excel file attached hereto, including the information, data and content contained therein (the “Model”), to be Confidential Information as defined within the Aspose Pty Ltd’s End User License Agreement last revised January 19, 2021. By accessing the Model, Aspose Pty Ltd. acknowledges and agrees that the Model has been provided to it solely for the purposes of resolving the technical issues related thereto and shall not be used by it, its employees, contractors or agents for any other purpose than as stated herein.

@rwood,
We have observed this issue and logged it in our database for detailed analysis. You will be notified here once any update is ready for sharing.

This issue is logged as:
CELLSNET-48039 - Infinite loop when saving copied workbook

1 Like

Quick clarification, I now believe this was introduced in Aspose.Cells 20.12.0 (not 21.1.0 as I initially wrote).

I’ve tested this on a very large collection of our workbooks and it’s occurring on about 1% of them, but I can’t identify any obvious patterns. Happy to provide more example workbooks if needed.

@rwood,
Thank you for sharing further information. We have noted it with the ticket and will consider it while working on this issue.

@rwood,
This is to inform you that we have fixed your issue now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

1 Like

@rwood
Please try the latest fix 21.4.6
Aspose.Cells21.4.6 For .Net2_AuthenticodeSigned.Zip (5.5 MB)
Aspose.Cells21.4.6 For .Net4.0.Zip (5.5 MB)
Aspose.Cells21.4.6 For .NetStandard20.Zip (5.5 MB)

I’ve run 21.4.6 through our test suites and everything works as expected. Thank you very much for the quick fix!

@rwood,

Good to know that your issue is resolved by the new fix. In the event of further queries or issue, feel free to write us back.

The issues you have found earlier (filed as CELLSNET-48039) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao