Issue in the Aspose.Imaging.Graphic.MeasureString method

When we try to pass the arguments in the measure string in v23.8.0 it works properly, whereas when we update the aspose.imaging above v23.11.0 we face an error with message Key cannot be Null. Parameter Name: Key. source : mscorlib

@hemalp , Could you share the code example and/or the image you are using? So we can reproduce the error and deal with it.

image.png (19.6 KB)

This is the basic sample that we have tried and still facing the issue.

@hemalp , let us review your case. You will answered be answered shortly!

@hemalp ,
Unfortunately, we did not manage to reproduce your error for a random image!
Could you share some additional info on your operating system and .Net version? Is it a specific image that causes an error (in this case it might also be useful to share)?

OS : windows 11
.Net : .net framwork 4.8
Is it a specific image ?: no, we are facing issue in all images

@hemalp , the code example below works as expected for Aspose.Imaging.23.12.

var path = @"";
using (var image = Image.Load(path))
{
    var g = new Graphics(image);
    var size = g.MeasureString("Hello", new Font("Arial", 10), new SizeF(100, 100), StringFormat.GenericDefault);
    Console.WriteLine(size);
}

Could you share full error stack trace and Imaging version?

We have created a new project and added the latest aspose.Imaging dll, performed the measure string using the code you have provided on a tiff file and we are still facing the issue.

image.png (24.1 KB)

Stack trace :
at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at #=z_hVYfbXkVvmb8MlqWKvFbAFyFwjTGtVelLx6d10dvqoJYAaUcA==.#=zwGjxF4ZQtLEr()
at #=z_hVYfbXkVvmb8MlqWKvFbAFyFwjTGtVelLx6d10dvqoJYAaUcA==.#=zrmqkSEuAje7O(Boolean #=zGmuBwLfOeDcS)
at #=z_hVYfbXkVvmb8MlqWKvFbAFyFwjTGtVelLx6d10dvqoJYAaUcA==.#=zINQ_dLatiUYu(Font #=zbK8VA5k=, #=zsMqBnEkjj3PhPM9kmVu15XNbACZmRcVXiA== #=zSukr4NvdM1OX)
at #=z_hVYfbXkVvmb8MlqWKvFbAFyFwjTGtVelLx6d10dvqoJYAaUcA==.#=zE0DPP3UmTToN(Font #=zbK8VA5k=, #=zsMqBnEkjj3PhPM9kmVu15XNbACZmRcVXiA== #=zSukr4NvdM1OX)
at Aspose.Imaging.Graphics.MeasureString(String text, Font font, SizeF layoutArea, StringFormat stringFormat)
at AsposeOCR.Program.Main(String[] args) in D:\work\projects\AsposeOCR\AsposeOCR\Program.cs:line 60

@hemalp , We are reviewing your issue using the attached stack trace. You will be answered shortly!

@hemalp
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): IMAGINGNET-6892

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.