Error in release mode, but not in debug mode

Hello,

I’m using the Free Licence for my .NET MAUI application with Visual Studio.

When I run my app (Android) in debug mode, the PDF creation works perfectly, but in release mode I get this exception:

System.TypeInitializationException: TypeInitialization_Type, GemBox.Pdf.Content.PdfFonts
—> System.UriFormatException: net_uri_BadFormat
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
at System.Uri…ctor(String uriString)
at t..MoveNext()
at t.()
at t.e(String )
at .e(String )
at W.(Uri )
at W.(Assembly , String )
at W.()
at W.()
at W.(Uri ,  )
at W.[PdfFontFamily](Uri , String , Boolean , Func3 ) at GemBox.Pdf.Content.PdfFonts.(Uri , String , Boolean ) at GemBox.Pdf.Content.PdfFonts..cctor() Exception_EndOfInnerExceptionStack at GemBox.Pdf.Content.PdfFontFace.5b2nb4besfw93bw3sdyrelglx2easxdte() at .( ) at GemBox.Pdf.Content.PdfFontFace.GetHashCode() at .GetHashCode() at System.Collections.Generic.Dictionary2[[, GemBox.Pdf, Version=17.0.0.1565, Culture=neutral, PublicKeyToken=b1b72c69714d4847],[, GemBox.Pdf, Version=17.0.0.1565, Culture=neutral, PublicKeyToken=b1b72c69714d4847]].TryInsert( ,  , InsertionBehavior )
at System.Collections.Generic.Dictionary`2[[, GemBox.Pdf, Version=17.0.0.1565, Culture=neutral, PublicKeyToken=b1b72c69714d4847],[, GemBox.Pdf, Version=17.0.0.1565, Culture=neutral, PublicKeyToken=b1b72c69714d4847]].Add( key,  value)
at .( )
at .()
at GemBox.Pdf.Content.PdfFormattedText.get_FontSize()
at GemBox.Pdf.Content.PdfFormattedText.set_FontSize(Double value)
at APP.Page.CreationPDF()

Here is my code :

PdfFormattedText title= new();
title.TextAlignment = PdfTextAlignment.Center;
title.FontSize = 36;
title.FontWeight = PdfFontWeight.Bold;
title.Append(“Title”);
page.Content.DrawText(title, new PdfPoint(100, 100));

This issue only appears with Text. For example, I can create an image.

Also, if I remove title.FontSize = 36;, the error appears on title.FontWeight = PdfFontWeight.Bold;.

Do you have a solution ?

Thanks in advance.

Hi,

Please try again with this NuGet package:

Install-Package GemBox.Pdf -Version 17.0.1576-hotfix

Does this solve your issue?

Regards,
Mario

Hello,

Thank you for your reply.

Unfortunately, I still have the same problem.

Can you please try again with this NuGet package:

Install-Package GemBox.Pdf -Version 17.0.1577-hotfix

Does this solve your issue?

Regards,
Mario

1 Like

That works ! Thank you so much !