System.ArgumentException: Destination array was not long enough. Check destIndex and length- and the array's lower bounds

When creating and saving a workbook using Aspose.Cells, we are getting a stack trace error: Destination array was not long enough. Check destIndex and length, and the array's lower bounds.

This is a customer producing a report on their own data. I don't know yet how much data is there, and I haven't tried the latest Aspose.Cells release yet, but wanted to check if this is a known issue, and what would likely cause the problem. I saw a few old postings (circa 2004) with this error message, and those postings said the issues were fixed, but didn't go into detail on what the problem was.

System.Web.HttpException: Error executing child request for ../Common/DownloadTarget.aspx. ---> System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds.
at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
at Aspose.Cells.Record.x4c60c9e2927f2d75.x91b6dd5021f0df1e(String x4ba5dd095bef4f86, xaae832abae2edf07 x0ecec17af75ebd13)
at Aspose.Cells.Record.x4c60c9e2927f2d75.x1a32e6c8fced20bc(String x4ba5dd095bef4f86, Byte[] x9ce5f6008e05f2c8, xaae832abae2edf07 x0ecec17af75ebd13)
at Aspose.Cells.Record.x4c60c9e2927f2d75.x2f0a6883e99a7e92(xaae832abae2edf07 x0ecec17af75ebd13)
at Aspose.Cells.Record.x4c60c9e2927f2d75.x8215cd112f0e46ef(xaae832abae2edf07 x0ecec17af75ebd13, Worksheets x6d7b41a5fb54bb38)
at Aspose.Cells.Worksheets.xc45aec41e2cb5b99(xaae832abae2edf07 xcf18e5243f8d5fd3)
at Aspose.Cells.Worksheets.x668135b31fe5c8d9(xaae832abae2edf07 xcf18e5243f8d5fd3)
at Aspose.Cells.Worksheets.x806178efa0bb6fcf(FileFormatType xab59d5b558cd3dde)
at Aspose.Cells.Worksheets.xc26afd5362f5c1ec(Stream xcf18e5243f8d5fd3, FileFormatType xab59d5b558cd3dde)
at Aspose.Cells.Workbook.Save(Stream stream, FileFormatType fileFormatType)

Hi,

Thanks for providing us some details.

Well, it might be an issue with some older versions of the component, you should try our latest version v4.7.1. I have also attached the latest fix in the series v4.7.1.15. Please try it and let us know if it works fine. If you find any issue, kindly post your sample code, template file etc. here, we will figure out your issue asap.

Thanks for your time.

I am having the same issue, I just downloaded the latest version 4.8 and I still get this error. I have copied the data directly from my sql results and pasted them into Excel and it doesnt seem like there are more characters than what excel can handle. But for some reason the workbook would not save.

Any ideas?

Hi,

Could you try the attached latest version/fix if it works fine.

If you still find the issue, kindly create a sample console application, zip it and post it here. We will check your issue soon.

Thank you.

Hi,

I’m an Aspose.Total owner and I’ve run into the same problem when opening a file for reading, getting the “Destination array was not long enough to copy all the items in the collection. Check array index and length” on v4.8.0. I’ve tried the v4.8.0.13 with the same result. I’ve also just rebooted the server in which it is used with the same result, suspecting that this might be caused by not disposing of the component properly. I’m getting the same error.

The same code, in the same project did not produce the error a couple of days ago and the only differences are the inclusion of another two classes that make use of aspose.cells, that are unrelated to the specific algorithm.

The error unfortunately isn’t portable. I created a mini version of the aforementioned code into a testbed application and I’m getting the same thing on the server, but it runs fine on a XP x86 machine. The server runs Windows Server 2008 x64, almost fully updated. It fails to install the KB967723 update for unknown reasons, if that is related by any way. Is this by any means a known issue?

I have also uninstalled the latest KB969947, KB973565, KB973687 and KB976098 updates, with no effect.

Are there any related services, known issues with updates etc that I have to be concerned with?

Thanks a lot in advance,

H.Tsavdaris

Hi,

Thank you for considering Aspose.

Please try the attached latest version of Aspose.Cells. If you still face the problem, please share the sample code and template file here to reproduce the issue and we will check it soon.

Thank You & Best Regards,

Thanks for the update. It works fine!

Hello,
I am using Aspose.Cells to import data into Excel sheet from datatable , I am facing same problem, It is permitting only 7500 records at max( when i tried after decreasing the record number) in the sheet, while I have more than 15k record in the datatable. Applying the attached dll didn’t worked for me. Please reply ASAP, its urgent.

Hi,

Please try the attached version (latest version/fix), if you still find the issue, create a sample console demo application and post it here to show the issue, we will check it soon.

Thank you.