We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Saving jpg image throwing an exception

Hi Team!

I had a previous post about an issue Saving jpg after watermark throwing exception. I cannot view and comment on the post when I’m logged in (both Chrome and FireFox).
image.png (45.8 KB)

We still have this issue in a certain use case : Saving jpg after watermark throwing exception

The fix is working in a simple .Net Core 3.1 project what I attached in the previous post.

Our use case is the following:

We are hosting the .Net from native code so basically we are calling C# functions from C++ code. In this case the following exception is still occurs when we saving a jpg image.

Unhandled exception. System.Runtime.Serialization.SerializationException: Unable to find assembly ‘Aspose.Imaging, Version=, Culture=neutral, PublicKeyToken=716fcc553a201e56’.
at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name)
at System.Runtime.Serialization.Formatters.Binary.ObjectMap…ctor(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
at System.Runtime.Serialization.Formatters.Binary.BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
at System.Runtime.Serialization.Formatters.Binary.BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
at System.Runtime.Serialization.Formatters.Binary.BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(BinaryParser serParser, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, Boolean check)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
at .(Object )
at .()
at .Process(Rectangle , Byte[] , Point , Point)
at .Process(Rectangle , Int32[] , Point , Point)
at .Process(Rectangle , Int32[] , Point , Point)
at ​ .Process(Rectangle , Byte[] , Point , Point)
at … (Rectangle )
at .( , IList1 , ) at .(Rectangle , , , Int32, Int32 , ) at .(Rectangle , , ) at .(Byte[][] ) at .(Int32 ) at .( , Rectangle , Int32 , Int32, Int32 , Boolean ) at .(Int32 , Int32 , Int32 , Rectangle) at . (Rectangle ) at .LoadRawData(Rectangle , RawDataSettings , IPartialRawDataLoader ) at .LoadPartialArgb32Pixels(Rectangle , IPartialArgb32PixelLoader ) at . (Rectangle ) at .( , IList1 , )
at .(Rectangle , , , Int32, Int32 , )
at .(Rectangle , , )
at . (Rectangle , IPartialArgb32PixelLoader )
at Aspose.Imaging.FileFormats.Jpeg.JpegImage.(RasterImage , JpegOptions , , Rectangle)
at Aspose.Imaging.FileFormats.Jpeg.JpegImage.(RasterImage , Stream , JFIFData , JpegExifData, XmpPacketWrapper , Byte[] , JpegOptions , Rectangle )
at Aspose.Imaging.FileFormats.Jpeg.JpegImage.SaveData(Stream stream)
at Aspose.Imaging.DataStreamSupporter.Save(Stream stream)
at Aspose.Imaging.DataStreamSupporter.Save(String filePath)
at DotNetLib.Lib.CustomEntryPoint(LibArgs libArgs)

  • OS: Ubuntu 20.04.2 LTS
  • Aspose.Imaging version: 21.10.0
  • .Net Core 3.1 project

Sample file: sample_image.jpg (824.5 KB)

.NET Core Project:Sample_project.zip (18.5 KB)

You can build and run the project with the dotnet run command from the /Sample_project/hosting directory.


We are sorry for your inconvenience. May be there has been a network glitch. Can you please try accessing following link.

You are getting this issue for every image file as from stack trace it seems that it cannot access Aspose.Imaging assembly.


I tested the case with other jpeg images but the problem only occurs with this specific image that I attached.

Did you managed to reproduce the issue in your environment?


In order to investigate the issue further on our end, I have created a ticket with ID IMAGINGNET-4881 in our issue tracking system. We will share the feedback with you as soon as it will be shared by our product team.

1 Like