简体   繁体   中英

Xfinium.Pdf.NET not working in Blazor WASM .NET5/6 project

I'm developing a Blazor PWA project where the WASM client needs to generate PDFs. My employer had already purchased an Xfinium license, thus I have been using it in our project. I have just recently ported the project from .NET Core 3.1 to .NET5 and have begun encountering issues with the Xfinium library. First of all, I am using the Xfinium.Pdf.NET library , as it supposedly supports .NET5. Upon attempting to initialize any object from this library (ie PdfFlowDocument test = new();) I am immediately greeted with the following error: Assertion at /__w/1/s/src/mono/mono/mini/interp/transform.c:3592, condition <disabled> not met , which causes my application to crash. To further pinpoint this issue, I created two separate Blazor PWA WASM projects, one with .NET5 and one with .NET6, installed the Xfinium.Pdf.NET library, and attempted to use it. Both resulted in the exact same error as above. I then recreated this on a separate machine as well.

I have reached out to Xfinium support in regards to this issue, and have yet to hear back. Wondering if anyone else has experience a problem similar to this one. For the time being I will simply keep the project on .NET Core 3.1 (the upgrade was to fix another issue where we couldn't read more than 2mb at a time from indexed db database).

Any help is much appreciated!

Upon receiving a helpful workaround from the Microsoft Forums and a response from the Xfinium support team, I can answer my own question.

The Xfinium support team was able to recreate my issue with the obfuscated NET version of their Xfinium.Pdf library. Upon testing the non-obfuscated assemblies of the same library, the problem was non-existant. Therefore, they believe the obfuscation tool is the source of the problem and have notified me that they have reached out to their obfuscation tool vendor. I will be alerted by their support team when the issue is fixed.

As for a workaround, a user named Bruce on the Microsoft Q&A Forums suggested I try the NetStandard version of the library in my NET5 project. This solved my problem. I then alerted the Xfinium support of this solution and they told me that the NetStandard assemblies for this library are in fact obfuscated using a separate tool.

Thus, for the time being, I will be going forward using the NetStandard version of the library. I will update this post when Xfinium support alerts me that a fix has been shipped.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM