NullReferenceException referencing image

Referencing a SVG image using the current latest version, 23.10, causes:
System.NullReferenceException: ‘Object reference not set to an instance of an object.’

    private static void NullReferenceException()
    {
        const string html = "<html><body><img src='https://logincdn.msauth.net/shared/1.0/content/images/backgrounds/2_bc3d32a696895f78c19df6c717586a5d.svg' /></body></html>";

        using (var document = new Aspose.Html.HTMLDocument(html, "."))
            Aspose.Html.Converters.Converter.ConvertHTML(document, new PdfSaveOptions(), "out.pdf");
    }

@GrantWalker

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): HTMLNET-5020

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.

1 Like

@GrantWalker

We were unable to reproduce the NRE in our environment while testing with 23.10 version of the API. Can you please share some more details like your environment information and complete stack trace?

Hi, here is the stack trace, it looks like the error is related to interacting with the hosting site as downloading the SVG and referencing it from the file system works.

System.NullReferenceException: Object reference not set to an instance of an object.
at  …ctor(​ ,  , Int32 ,  )
at  ..()
at  .(String , Func`1 )
at  .(HTMLImageElement ,  ,  ,  ,  )
at  .(Element ,  ,  , ​ ,  ,  )
at  .(Element ,  ,  , ​ ,  ,  )
at  .(Element ,  ,  , ​ ,  ,  )
at  .(Element ,  ,  ,  )
at  .(Document , RenderingOptions , IDevice , ​ ,  , ​ )
at  .​ ​ (IDevice , ​ )
at  .()
at  . ​ (Renderer , ​ [] , IDevice , CancellationToken )
at Aspose.Html.Rendering.HtmlRenderer.(IDevice , CancellationToken , Element[] , Document[] )
at ​ .​ ​ (IDisposable , IDevice , CancellationToken , Document[] )
at Aspose.Html.HTMLDocument.RenderTo(IDevice device)

@GrantWalker

We have updated the ticket information and will let you know after investigating it accordingly.

1 Like