|
Rank: Newbie Groups: Member
Joined: 7/20/2022 Posts: 5
|
We have integrated EO.Pdf into our .NET 5 application. The HtmlToPdf function throws the exception "The type initializer for 'EO.Internal.nbye' threw an exception" In the meantime we resolved the problem with the additional initialization.
Code: C#
EncodingProvider encodingProvider = CodePagesEncodingProvider.Instance;
Encoding.RegisterProvider(encodingProvider);
I think this is a valid reason for you to provide a NuGet package built for .NET Core.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi, Have you tried reference System.Drawing.Common and System.Text.Encoding.CodePages nuget packages? See here for more details: https://www.essentialobjects.com/doc/common/dotnetcore.htmlThanks!
|
|
Rank: Newbie Groups: Member
Joined: 7/20/2022 Posts: 5
|
System.Drawing.Common and System.Text.Encoding.CodePages are already implicitly included with version 5.0.0 by the package Microsoft.Windows.Compatibility 5.0.2. HtmlToPdf only works with the additional Encoding.RegisterProvider initialization.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
What version do you use? The latest version actually automatically calls RegisterProvider. So it is no longer necessarily for you to do so.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 7/20/2022 Posts: 5
|
Initially we faced the problem with version 22.1.13 without a license at that time. With the current version 22.1.67 i don't see any changed behavior. Without the AddLicense call the exception still occurs without the RegisterProvider call. With the AddLicense call it even works without the RegisterProvider call. But it's the same with 22.1.13
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi, We tested this on our end without license key and it still works properly. Can you send a test project to us if you are still having problem? See here for more information on how to send test project to us: https://www.essentialobjects.com/forum/test_project.aspxThanks!
|
|
Rank: Newbie Groups: Member
Joined: 7/20/2022 Posts: 5
|
It wasn't that easy to reproduce this in a small example. I had to bring EO.WebBrowser.Wpf on board. I posted the test project through Contact Us.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Thanks for the test project. We have found that its the SelfContained attribute in your project file that triggers the issue. This would cause our code that detects whether your application is running on .NET Core to fail thus not automatically calling RegisterProvider. We will change our code to detect this scenario so that our next build should work correctly when SelfContained is set to true.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
This is just to let you know that we have posted a new build that should resolve this issue. You can download the new build from our download page. Please take a look and let us know how it goes.
Thanks!
|
|