This is the template Blazor/Webassmebly application modified to use a simple native dependency, as explained in https://docs.microsoft.com/en-us/aspnet/core/blazor/webassembly-native-dependencies
Unfortunately this does not work; instead it fails with the following stacktrace:
566143 @ dotnet.6.0.0.kfqc9c1yy5.js:1428
_emscripten_asm_const_int @ dotnet.6.0.0.kfqc9c1yy5.js:5535
$wasm_trace_logger @ dotnet.wasm:0x2186d2
$eglib_log_adapter @ dotnet.wasm:0xb8610
$monoeg_g_logstr @ dotnet.wasm:0x1fd9ac
$monoeg_g_logv_nofree @ dotnet.wasm:0x1fd950
$monoeg_g_logv @ dotnet.wasm:0x1fd8fd
$monoeg_g_log @ dotnet.wasm:0x1fd9cc
$g_log_disabled @ dotnet.wasm:0x1fd9ff
$mono_wasm_get_interp_to_native_trampoline @ dotnet.wasm:0x1f4fba
$ves_pinvoke_method @ dotnet.wasm:0x1807a
$interp_exec_method @ dotnet.wasm:0xa187
$interp_runtime_invoke @ dotnet.wasm:0x8f30
$mono_jit_runtime_invoke @ dotnet.wasm:0x1d5a9f
$do_runtime_invoke @ dotnet.wasm:0x90a05
$mono_runtime_invoke_checked @ dotnet.wasm:0x90992
$mono_runtime_try_invoke_array @ dotnet.wasm:0x95111
$mono_runtime_invoke_array_checked @ dotnet.wasm:0x957aa
$ves_icall_InternalInvoke @ dotnet.wasm:0x6ee19
$ves_icall_InternalInvoke_raw @ dotnet.wasm:0x738fb
$do_icall @ dotnet.wasm:0x18c8c
$do_icall_wrapper @ dotnet.wasm:0x17ef5
$interp_exec_method @ dotnet.wasm:0xa061
$interp_runtime_invoke @ dotnet.wasm:0x8f30
$mono_jit_runtime_invoke @ dotnet.wasm:0x1d5a9f
$do_runtime_invoke @ dotnet.wasm:0x90a05
$mono_runtime_try_invoke @ dotnet.wasm:0x91137
$mono_runtime_invoke @ dotnet.wasm:0x933b1
$mono_wasm_invoke_method @ dotnet.wasm:0x2181db
Module._mono_wasm_invoke_method @ dotnet.6.0.0.kfqc9c1yy5.js:9757
managed__Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_BeginInvokeDotNet @ managed__Microsoft_A…eginInvokeDotNet:19
beginInvokeDotNetFromJS @ blazor.webassembly.js:1
b @ blazor.webassembly.js:1
invokeMethodAsync @ blazor.webassembly.js:1
(anonymous) @ blazor.webassembly.js:1
invokeWhenHeapUnlocked @ blazor.webassembly.js:1
S @ blazor.webassembly.js:1
C @ blazor.webassembly.js:1
dispatchGlobalEventToAllElements @ blazor.webassembly.js:1
onGlobalEvent @ blazor.webassembly.js:1
IIUC this happens because the list of supported native signatures is pre-determined in the runtime