Blazor WebAssembly

1
Dale
5/10/2021 3:22 PM

We are attempting to use CadLib NetStandard in a .Net Blazor WebAssembly project and are running into an issue calling WWLicense.SetLicense(). The application assembly is signed with key you've provided.

We are using WW.Cad.Standard version 1.0.0-rc52
Running into the same issue with both .net5.0, and well as .net6.0 preview 3
Do you have any directions for getting this to work? (stack trace is attached)

Wout
5/11/2021 12:43 PM

I tried a Blazor web assembly project (I'm still on .NET Core 3.1 at the moment, VS 2019), but can't seem to debug program.cs (the breakpoint doesn't get hit). Blazor isn't production ready is it? I don't want to invest too much time in these experimental technologies MS comes up with.

- Wout

Dale
5/11/2021 12:57 PM

I believe Blazor Web Assembly has been production ready for over a year:

https://visualstudiomagazine.com/articles/2020/05/19/blazor-webassembly-3-2.aspx

I have not tried .NET Core 3.1, as we have moved to .NET 5.0. Are you able to reproduce the error in 3.1?

I expect the library itself to work if we can get past this issue with setting the license. Are there any alternative ways of doing this so we can verify that?

Wout
5/11/2021 1:01 PM

Well, nothing actually happens in .NET 3.1, and I can't even debug it. Maybe I need to do it in .NET 5.0 to be able to debug?

Dale
5/11/2021 2:36 PM

Its possible. I am using VS Code (there are VS instructions as well), and have followed the instructions here, and can successfully hit my break points:

https://docs.microsoft.com/en-us/aspnet/core/blazor/debug?view=aspnetcore-5.0&tabs=visual-studio

my steps:

Create app:
dotnet new blazorwasm -n app

sign assembly with key.
(in csproj file):

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>latest</LangVersion>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

add code to set license:

WWLicense.SetLicense("license here");

set up launch.json like this:

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "blazorwasm",
"name": "Attach and Debug Blazor WebAssembly Application",
"request": "attach",
"browser": "edge",
"url": "http://localhost:5000"
}
]
}


cd app
dotnet build
dotnet run

from debug menu, run and debug the configuration from the above launch.json

Wout
5/13/2021 2:56 PM

Hi,

It looks like the BouncyCastle.NetCore library that CadLib is using is not working in web assembly (new BigInteger(byte[]) crashes, without throwing an exception). I can file a bug report to BouncyCastle.

Debugging is painful too by the way, 90% of the time it doesn't work, and without a Task.Delay at the start the debugger doesn't even attach and you're left wondering what the hell is happening. Even with the Task.Delay debugging sometimes works, but mostly it doesn't, because something crashes before you get there. Plus in IIS Express debugging doesn't work either, VS doesn't bother notifying you of this either. All together a rather unpleasant experience. For now I'm gonna say that CadLib doesn't support Blazor.

- Wout

Dale
5/13/2021 4:22 PM

Thank you for looking into this. I have also tried simply referencing the BouncyCastle.NetCore, and tried creating a BigInteger from a Blazor project, and i see the same behavior. If you want to file a bug it would be appreciated - I may do the same.

1