Free Support Forum - aspose.com

Save causes ArgumentOutOfRangeException

Hello,

When I call save (filename or stream) on the attached file, it throws the following. This may be because the file has no shapes.

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Result StackTrace:
at System.Collections.ArrayList.get_Item(Int32 index)
at Aspose.Diagram.ShapeCollection.()
at .(Page , Diagram )
at .()
at .()
at . ()
at .()
at .Save()
at .(Stream , SaveFileFormat )
at Aspose.Diagram.Diagram.Save(Stream stream, SaveOptions options)
at Aspose.Diagram.Diagram.Save(String filename, SaveFileFormat format)

Regards,

Andrew

Hi Andrew,


Thank you for contacting support. Kindly let us know in which file format you are saving this VSDM drawing. Please send us your complete source code (Aspose.Diagram API related part). It will help us to replicate the same error on our side. We shall investigate and reply you appropriately. Your response is awaited.

I was saving to VSDM:

using fileStream as New IO.FileStream(filename, IO.FileMode.Open, IO.FileAccess.ReadWrite)
dim diagram as New Aspose.Diagram.Diagram(fileStream)
diagram.save(fileStream, Aspose.Diagram.SaveFileFormat.VSDM)
end using

Hi Andrew,


Thank you for the details. Please download and try the latest Hotfix version: Aspose.Diagram for .NET 17.3.2.0 and let us know how that goes on your side. In our working environment, it does not throw the said error.

Hello Imran,

I was already running 17.3.2.0.

Regards,

Andrew

Hi Andrew,


Thank you for the details. We are unable to replicate the same error in our working environment. Kindly prepare a simple console application which reproduces this error on your side, and then send us its zip archive for the testing purposes. We shall investigate and reply you appropriately.

Attached as requested.

Hi Andrew,


Thank you for sending a sample project application. It works fine after applying a valid Aspose license. We recommend our clients to always apply a valid Aspose license before testing. Please refer to this help topic: Apply License to Aspose.Diagram for .NET API