Opening a Aspose.Pdf.Document from html file is stack overflowing

The following code is causing a stack overflow (horrible, because it is completely crashing our app) using Aspose.Pdf v22.1:

using (var pdfDocument = new Aspose.Pdf.Document(savePath, new Aspose.Pdf.HtmlLoadOptions())) { }

image.png (26.3 KB)

fbeb00f0-4659-4ae0-b0af-1ce7acdf1676 Stack Overflow.zip (11.6 KB)

@ted-1

We have tested the scenario using the latest version of Aspose.PDF for .NET 22.3 and have not found the shared issue. So, please use Aspose.PDF for .NET 22.3.

We can’t use Aspose.PDF v22.3 until this issue is fixed!

This issue is absolutely NOT FIXED in v22.3, see screenshots below. Can you please get your act together. This is a horrible error, please fix ASAP. A 3rd-party DLL should NEVER be causing a stack overflow!!

image.png (28.4 KB)

image.png (71.5 KB)

@ted-1

We tested the scenario at Windows 10 using .NET 6.0. Could you please share the .NET framework that you are using?

Same, exact issue in .NET 6, Tahir. See attach project and screenshot.

TestAsposeMsg.zip (13.3 KB)

image.png (61.8 KB)

Tahir, In the meantime, while you are investigating this, the end goal of our code is convert the content of msg/eml files to pdfs. Since I didn’t see a way to do that directly in the documentation (Loading and Saving Message|Documentation), we are first converting to html using Aspose.Email, then using Aspose.Pdf to convert that html file to a pdf.

I there a way to convert the content of a msg/eml file directly to a pdf, without having to convert to html first?

See my earlier question here: How to Convert MSG to PDF

@ted-1

We have tested the scenario with shared project file and have not found the shared issue. Please check the attached screenshot. image.png (100.4 KB)

Please make sure that you are using the same HTML. Could you please check the same application at some other system? It would be great if you please check this HTML with other .NET versions and share your findings.

Unfortunately, there is no direct way convert MSG to PDF conversion.

Tahir,

This makes absolutely no sense, please explain more!? And please provide a solution or workaround. This is a horrible issue that is crashing our Production servers, and we have no way to fix it since it is a StackOverflowException! Please raise this issue with your manager so we can get a solution ASAP!

I gave you the exact project we are using to repo the issue, included the exact file with the project that causes the issue, linked via nuget to the exact version of Aspose.PDF, and showed you a screenshot of the stack overflow that happens running the single line of code! How in the world can you not repo the error!? It happens every time whether or not running in the debugger! This same error, with the same file, is also happening on several of our Production Windows Server 2019 VMs, as well, so this is not isolated to a single machine or version of .NET!

Also, every time you reply to this issue, your statements don’t make sense. What do you mean “Please make sure that you are using the same HTML”? I included the EXACT file with the project I submitted to this ticket. Did you even download the project and run it???

Please raise this issue with your manager and switch over to another Dev who can figure out what is going on. We’ve been loyal customers of Aspose for years now and spent a ton of money with you guys, and the quality of the toolkits have gone downhill. Please get a resolution for us, or I will call in myself to get this figured out!!

Tahir, I’m also attaching console output when running the same, exact project (attached to this ticket) on our Windows Server 2019 instance that crashes the app. This shows the StackOverflowException, along with a stack trace of the same obfuscated method getting called over and over in a recursive loop. This app was built with the exact project I gave you above and linked to the exact version of .NET 6 and Aspose.PDF v.22.3

image.png (53.7 KB)

image.png (9.9 KB)

Also, as a reminder, this code is blowing up on .NET Standard 2.1, .NET 5, and .NET 6, so it is not specific to the .NET version. It must be something in Aspose.

Here’s the same stack overflow in .NET 5, for example:

image.png (101.7 KB)

Aspose must be blowing up in a recursive loop calling the obfuscated function in the console.

Lastly, doing even more testing with this issue: the StackOverflowException does NOT happen with Aspose.PDF v22.2, but DOES happen with v22.3. So, this bug was introduced between those two versions.

@ted-1

Please accept my apologies for your inconvenience.

We tested the scenario at Windows 10 (64 bit) with .NET 5.0 and 6.0 and have not faced any exception.

Please spare us some time for the investigation of this issue at Windows Server 2019. If you are using any other operating system, please share its detail. We will investigate the issue at same environment. Thanks for your cooperation.

Tahir, I’m finding it really hard to understand why you cannot repo this issue. It is happening on multiple servers here on multiple versions of .NET.

I’m attaching yet another file that is blowing up with a StackOverflowException on Aspose.PDF v22.2 (yes, v22.2!) using the exact same project and code, and same recursive loop displayed in the console output:

image.png (52.2 KB)

e6cc035e-6956-42d4-b015-b322f9129b06 Stack Overflow.zip (11.6 KB)

You guys have got to get this fixed ASAP, it is killing our servers and apps! A third party library should never, ever throw an exception like this.

Here is the origin of the recursive call using the first attached html file. Can you please track down the Aspose call that would cause this infinite recursion and stack overflow:

image.png (83.8 KB)

@ted-1

We have logged this problem in our issue tracking system as PDFNET-51581. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as PDFNET-51581) have been fixed in Aspose.PDF for .NET 22.4.