Exceptions when trying to convert simple HTML to PDF

I am evaluating Aspose.HTML (version 24.7) for converting a rather simple HTML that comes as a string to a PDF in the .NET 8 (ASP.NET Core) application. For this, I have used the basic example provided here, as I need a memory stream as an output. My code is simple for a test:

using var streamProvider = new MemoryStreamProvider();

using var config = new Configuration();

var options = new PdfSaveOptions();
string RenderedHTML = “my HTML here, I have attached it”;
Converter.ConvertHTML(RenderedHTML, “/”, config, options, streamProvider);

var memory = streamProvider.Streams.First();

The exceptions are

System.Reflection.AmbiguousMatchException
HResult=0x8000211D
Message=Ambiguous match found for ‘ System.String ()’.
Source=System.Private.CoreLib
StackTrace:
at System.DefaultBinder.SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers) in /_/src/libraries/System.Private.CoreLib/src/System/DefaultBinder.cs:line 628

Followed by
System.InvalidOperationException
HResult=0x80131509
Message=Unsupported format 1 for lookup type: 1
Source=Aspose.HTML
StackTrace:
at  . ​ ​ ()

and there are more there. The call stack is useless as the method names are hidden (by the obfuscator?).

I have attached the sample HTML. html_source.html.zip (568 Bytes)

I would like to purchase a license, but this error is a showstopper right from the start, and I don’t understand what the possible reasons can be.

Sincerely yours
Eugene Mayevski

@mayevski

We are checking it and will get back to you shortly.

@mayevski

We tested in our environment under .NET 8.0 and could not replicate the issue using the latest version of the API. Below is the PDF attached that we obtained at our end.

stream-provider.pdf (34.7 KB)

Can you please make sure that you are using the latest version of the API and if you are still noticing the issue, please share your sample console application with us in .zip format so that we can further proceed accordingly.

Thank you for checking. The issue may be specific to ASP.NET Core. I will try to reproduce it with a console application on the weekend.

@mayevski

Sure, please take your time and let us know about your findings.

The problem is specific to my ASP.NET Core application (also in the main function, not just in the request handlers); it does not happen in a console application, neither it happens in a fresh ASP.NET Core server app. My application has quite a few dependencies, and while I tried to reference them in the test project, I failed to reproduce the problem with a test. Still, it does occur in my main application. There must be a conflict with some other package, but have no clue, which one.

@mayevski

Maybe you can try removing the assemblies being used in DefaultBinder Class to see which assembly is creating conflicts. Please feel free to let us know if you are able to reproduce the issue in a fresh console or ASP.NET application. We will further proceed accordingly if the issue is specifically related to the Aspose.HTML.