Error while converting tiff to jpg as well as compressing multi-tiff file in Aspose.Imaging for .NET 4.0.0.0

Dear Team,

I was facing issues while converting tiff to jpg as well as compressing the multi-tiff file occasionally. Below are the errors which I was facing.

  1. Aspose.Imaging.CoreExceptions.ImageLoadException: Image loading failed. —> System.ArgumentException: An item with the same key has already been added.

  2. Aspose.Imaging.CoreExceptions.FrameworkException: Index was outside the bounds of the array. —> System.IndexOutOfRangeException: Index was outside the bounds of the array.

We are not able to reproduce the same in every run. As I mentioned above that it happens occasionally.

Stack trace for "An item with the same key has already been added"

Error while compressing multi-tiff file with errorImage loading failed.
Aspose.Imaging.CoreExceptions.ImageLoadException: Image loading failed. —> System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at ? .(JpegMarkers , Int32 )
at ? .(StreamContainer , LoadOptions )
at ? .(StreamContainer , LoadOptions )
at Aspose.Imaging.Image.(StreamContainer , LoadOptions )
— End of inner exception stack trace —

Stack trace for "Index was outside the bounds of the array."

Error while compressing multi-tiff file with errorIndex was outside the bounds of the array.
Aspose.Imaging.CoreExceptions.FrameworkException: Index was outside the bounds of the array. —> System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at ? .(IObjectWithBounds )
at Aspose.Imaging.RasterImage..Process(Rectangle , Int32[] , Point , Point )
at ? .Process(Rectangle , Byte[] , Point , Point )
at ?? .(Byte[][]& , Rectangle )
at ?? .(Object , )
— End of inner exception stack trace —

I am currently using .Net Aspose.Imaging version is 4.0.0

@sameertanna

You are using a very old API version. Please try using latest Aspose.Imaging for .NET 20.12 and in case there is still an issue then please share the working sample project along with source file reproducing the issue.

Hi @mudassir.fayyaz,

Thank you for your reply. I’ll check with the latest version as you suggested but can you help us to let us know what exactly this error is as this will help to provide the RCA to my client? Please find the below error stack trace

Error while compressing multi-tiff file with errorIndex was outside the bounds of the array.
Aspose.Imaging.CoreExceptions.FrameworkException: Index was outside the bounds of the array. —> System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at ? .(IObjectWithBounds )
at Aspose.Imaging.RasterImage…Process(Rectangle , Int32[] , Point , Point )
at ? .Process(Rectangle , Byte[] , Point , Point )
at ?? .(Byte[][]& , Rectangle )
at ?? .(Object , )
— End of inner exception stack trace —

@sameertanna

We may need the source file and used sample code reproducing the issue. We may consider this as an issue in our issue tracking system if that is reproduced using latest version. If the latest version does not exhibit the issue, we may not be able to call this an issue and investigate an older version which is no longer supported.