Welcome Guest Search | Active Topics | Sign In | Register

EO.Pdf not working in .NET 5 Options
wolkor
Posted: Wednesday, July 20, 2022 10:47:47 AM
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.
eo_support
Posted: Wednesday, July 20, 2022 10:53:07 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,083
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.html

Thanks!
wolkor
Posted: Wednesday, July 20, 2022 11:26:27 AM
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.
eo_support
Posted: Monday, July 25, 2022 11:35:05 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,083
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!
wolkor
Posted: Tuesday, July 26, 2022 1:03:36 PM
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
eo_support
Posted: Tuesday, July 26, 2022 1:12:22 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,083
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.aspx

Thanks!
wolkor
Posted: Monday, August 1, 2022 6:31:10 AM
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.
eo_support
Posted: Monday, August 1, 2022 5:14:43 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,083
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.
eo_support
Posted: Monday, August 22, 2022 1:19:23 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,083
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!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.