C
C#2y ago
riot_time

❔ .net 7 to web assembly help

I have seen the new .net 7 webassembly experimental tool and wondered if I can use it in my project. I have a C# server that gets an image (from a FormData) and returns a barcode (if present) from the image using the IronBarcode lib. I tried to move this method to the experimental tool of webassembly, and it I have got a bunch of errors trying to JSExport my method (pic 1 -- making it static didn't help either), so I guessed changing it to none async function will solve that (although it was explained in this demo that Tasks can be exported). As I though it worked and no build errors was thrown, but still I got no luck running the function (pic2), since in the browser it self I got this error (pic3) which made wondering - what are the limitations of compiling .net 7 to webassembly (maybe some nugets cannot be compiled to webassembly?). Any help would be appreciated
6 Replies
Dusty
Dusty2y ago
HEy So if using JsExport your method needs to be static You're getting the error from the IronBarCode library when setting your license key I'd guess the licensing stuff doesn't work in webassembly?
Dusty
Dusty2y ago
You could try using something like this to render barcodes https://www.questpdf.com/going-production/font-management
Font management | QuestPDF
Open-source modern .NET library for PDF document generation. Offering comprehensive layout engine powered by concise and discoverable C# Fluent API.
riot_time
riot_timeOP2y ago
Hey, yes I did changed it to static , but as it seems I was unable to jsexport a the method because it was async Task. Why is that? In the demo they say it should work How can you be sure about that
Dusty
Dusty2y ago
Cause the error says it The method gets called But throws an exception when executing the licensekey setter
riot_time
riot_timeOP2y ago
I know that, I ment - why is that happening only in web assembly? What are the limitations ? Cause in regular console app it works
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server