Using 8.0.1.3 the following code throws an exception while inserting rows. (see attached image).
I have not been able to provide any further detail at this stage, however hopefully this information is enough for you to track down the issue. I note from the release notes of version 8, that the mechanics behind RowCollection have changed, and I am assuming this exception is related to those changes.
This is the code that causes the exception:
Worksheet.Cells.InsertRows(21, 24);
This is the Stack Trace at the point the exception is thrown:
at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)\r\n
at System.Collections.Hashtable.Add(Object key, Object value)\r\n
at Aspose.Cells.RowCollection.(Int32 , Int32 , Int32 )\r\n
at Aspose.Cells.RowCollection.(Int32 , Int32 , )\r\n
at Aspose.Cells.Cells.(Int32 , Int32 , )\r\n
at Aspose.Cells.Cells.InsertRows(Int32 rowIndex, Int32 totalRows)\r\n
Hi Michael,
Hello Babar,
It is a bit difficult to provide a narrowed down version of the code, as it occurs in our product that is over 40 thousand lines of code.
I have tried to narrow it down, but that has proved difficult. I have tried saving the Workbook (using Aspose) prior to the call that causes the exception, and then re-opening it and running the offending code, but this works ok. I am assuming because your internal HashTable gets re-established on the Open.
As the exception is occurring in your code (looking like trying to add a key that already exists), could I ask you to take a look how this could occur within your code.
Alternatively maybe if you could provide me with the debugging symbols I might be able to narrow it down for you.
Thanks for looking into it, and hopefully we can get it resolved one way or the other.
Regards,
Mike
Hi Mike,
var files = Directory.GetFiles(myDir, “.”);
foreach (var file in files)
{
var book = new Workbook(file);
book.Worksheets[0].Cells.InsertRows(21, 24);
}
Thanks Babar, I have installed 8.0.2 and run against my code base and cannot reproduce these issues with that version of Aspose Cells. (My code base is the same as when I initially raised the issue). I’m guessing that although these issues 42599 and 42596 were not specifically mentioned in the list of changes/fixes for 8.0.2, they have somehow been found and fixed, or related to some of the fixes specifically mentioned in the 8.0.2 release notes…??? Are you able to confirm…??? Cheers, Mike