com.aspose.imaging.coreexceptions.ImageSaveException

I tried to convert emf to png, it throws class com.aspose.imaging.coreexceptions.ImageSaveException: Image export failed. —> class com.aspose.imaging.internal.Exceptions.ArgumentOutOfRangeException: Non-negative number required.
Parameter name: value

Hello, @DiDiDiDiDi
Could you attach the sample causing the exception? We need to explore the issue using your EMF sample to provide a feedback.

Hi,
I have also encountered a similar issue when adding a license in C# (I’m writing a plugin for CRM 365)

image.png (56.8 KB)

Hi, @bsd.truongnv
Thank you for interest in Aspose.Imaging.
Unfortunately, the image you provided could not give us enough information. In fact the License.SetLicense could not throw the such exception.
Does this error occur the first time the Import method is called?
Or does this method work sometimes but then fail?
Which version of Aspose.Imaging do you use?
Which Operation System do you use?
Which version of .NET platform do you use?

I’m using .NET 4.7.1 and ILMerge to merge Aspose.Task.dll into my plugin, but it seems it is not supported. (I have tried creating a .NET console application, and it works fine). :slight_smile:

My plugin uses a .NET library

@bsd.truongnv , unfortunately we don’t have enought information or code sample to reproduce your issue. Can you please give us more information?

sample code:

public void Import(Entity entityProject, byte[] buffer)
{
string result = “”;
try
{
using (var stream = new MemoryStream(buffer, 0, buffer.Length))
{
Project project = new Project(stream);
result = project.RootTask.Name;
}
}
catch (Exception ex)
{
_tracingService.Trace(ex.ToString());
}
_tracingService.Trace(result);
throw new Exception(result);
}

Error:

System.TypeInitializationException: The type initializer for ‘#=z62h_mjo2Lwa3s9XQomWrbjd4colHuoFBOoLmzd7ErtCq’ threw an exception. —> System.TypeInitializationException: The type initializer for ‘#=zNTeplE8XcDP5AppFuEUvcWo$tQfw’ threw an exception. —> System.ArgumentOutOfRangeException: Non-negative number required.
Parameter name: value
at System.IO.UnmanagedMemoryStream.set_Position(Int64 value)
at #=zAcrRcezxkFtOw2kDt5odw8KWIU6C.#=zxspq1N8HmuLrl7TlRXt_GmY0jm37(Int32 #=ziPGnpzT$9uQgYue2kr7PX_BLSCrw, Boolean #=ztxMOvYeqNeruqSk9TtfHGJTo4Ted)
at #=zAcrRcezxkFtOw2kDt5odw8KWIU6C.#=z0xhse9U=(Int32 #=ziPGnpzT$9uQgYue2kr7PX_BLSCrw)
at #=zfnbl5Vd5YUIUU9yfQ0phym0yKDqzp2RirOZP1Vw_qUCv3kxiUQ==.#=z2RxwgxxMxJzRASWkp75nnmplHGxlm3cHHEH6H92Es5dQ3ntGhA==()
at #=zfnbl5Vd5YUIUU9yfQ0phym0yKDqzp2RirOZP1Vw_qUCv3kxiUQ==.#=zJKdxlZFHpoDC_CXn7eq7MsL6NydAXHy$cz4j0faGSIjdtxB9Eg==()
at #=zfnbl5Vd5YUIUU9yfQ0phym0yKDqzp2RirOZP1Vw_qUCv3kxiUQ==.#=zyaFfc4FNTSCdVVIbu5UC9Oy38dazpV8sHN$tYqArlQd0XSKT3w==(#=qEtsUsay5JDR1i$EWZj0w6IsrxAYXslW7p0_nbtNqeq8= )
at #=zfnbl5Vd5YUIUU9yfQ0phym0yKDqzp2RirOZP1Vw_qUCv3kxiUQ==.#=zAEcxHWqJfGy8L3pUiSNyTRpw$95NoNgG0i_wEkjZfWQjSZxKTw==()
at #=zNTeplE8XcDP5AppFuEUvcWo$tQfw…cctor()
— End of inner exception stack trace —
at #=z62h_mjo2Lwa3s9XQomWrbjd4colHuoFBOoLmzd7ErtCq…cctor()
— End of inner exception stack trace —
at #=z62h_mjo2Lwa3s9XQomWrbjd4colHuoFBOoLmzd7ErtCq…ctor()
at Aspose.Tasks.Project…ctor(Boolean #=zexyYRtfGteuO, Boolean #=zHv0ZUmltrmcBuDiU8g==)
at Aspose.Tasks.Project…ctor(Boolean #=zexyYRtfGteuO)
at Aspose.Tasks.Project…ctor(Stream stream, ParseErrorCallback parseErrorHandler)
at Aspose.Tasks.Project…ctor(Stream stream)
at Action_Project.Action_Project.Import(Entity entityProject, Byte[] fileData)

@bsd.truongnv , we will review your request and provide a feedback shortly!

@bsd.truongnv
As you use Aspose.Task, you should address this issue to the Aspose.Task team since we are Aspose.Imaging team, and we can not help you.
You need this branch Aspose.Tasks Product Family - Free Support Forum - aspose.com