runtime icon indicating copy to clipboard operation
runtime copied to clipboard

[wasm-mt] [uno] HttpClient calls fail with Unknown converter for type 13

Open sarosigy opened this issue 4 years ago • 8 comments

Description

@jeromelaban of Uno project suggested to report this bug here:

Creating an Uno app with WASM head, Running the WASM head with multithreading enabled, The HttpClient call await cli.GetAsync fails with:

Error: Assert failed: ERR41: Unknown converter for type 13

Reproduction Steps

The public repro is here: https://github.com/sarosigy/testwasm

Key points are for the wasm head:

  1. Set the targetframework to net7.0
  2. Enable threading (<WasmShellILLinkerEnabled>false</WasmShellILLinkerEnabled>)
  3. Use the newest, net7 targeted Uno.Wasm.Bootstrap package (<PackageReference Include="Uno.Wasm.Bootstrap" Version="7.0.0-dev.165" />)

Expected behavior

The call should succeed as with multithreading disabled

Actual behavior

Error: Assert failed: ERR41: Unknown converter for type 13 at get_marshaler_to_js_by_type (http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.js:5:35332) at bind_arg_marshal_to_js (http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.js:5:35074) at Object.mono_wasm_bind_js_function (http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.js:5:76564) at _mono_wasm_bind_js_function (http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.js:14:126432) at http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.wasm:wasm-function[344]:0x23804 at http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.wasm:wasm-function[312]:0x22a65 at http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.wasm:wasm-function[248]:0x13d06 at http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.wasm:wasm-function[247]:0x12ba4 at http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.wasm:wasm-function[8257]:0x1b2cf9 at http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.wasm:wasm-function[2118]:0x92371

Regression?

No response

Known Workarounds

Not know apart from fall back to single thread

Configuration

.NET 7.0.100-rc.1.22431.12 Debian 11

Other information

No response

sarosigy avatar Sep 23 '22 12:09 sarosigy

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

ghost avatar Sep 23 '22 12:09 ghost

Tagging subscribers to 'arch-wasm': @lewing See info in area-owners.md if you want to be subscribed.

Issue Details

Description

@jeromelaban of Uno project suggested to report this bug here:

Creating an Uno app with WASM head, Running the WASM head with multithreading enabled, The HttpClient call await cli.GetAsync fails with:

Error: Assert failed: ERR41: Unknown converter for type 13

Reproduction Steps

The public repro is here: https://github.com/sarosigy/testwasm

Key points are for the wasm head:

  1. Set the targetframework to net7.0
  2. Enable threading (<WasmShellILLinkerEnabled>false</WasmShellILLinkerEnabled>)
  3. Use the newest, net7 targeted Uno.Wasm.Bootstrap package (<PackageReference Include="Uno.Wasm.Bootstrap" Version="7.0.0-dev.165" />)

Expected behavior

The call should succeed as with multithreading disabled

Actual behavior

Error: Assert failed: ERR41: Unknown converter for type 13 at get_marshaler_to_js_by_type (http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.js:5:35332) at bind_arg_marshal_to_js (http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.js:5:35074) at Object.mono_wasm_bind_js_function (http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.js:5:76564) at _mono_wasm_bind_js_function (http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.js:14:126432) at http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.wasm:wasm-function[344]:0x23804 at http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.wasm:wasm-function[312]:0x22a65 at http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.wasm:wasm-function[248]:0x13d06 at http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.wasm:wasm-function[247]:0x12ba4 at http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.wasm:wasm-function[8257]:0x1b2cf9 at http://localhost:5000/package_d53de278c8d62fe352cc1fe90de748d791acb9c6/dotnet.wasm:wasm-function[2118]:0x92371

Regression?

No response

Known Workarounds

Not know apart from fall back to single thread

Configuration

.NET 7.0.100-rc.1.22431.12 Debian 11

Other information

No response

Author: sarosigy
Assignees: -
Labels:

arch-wasm, untriaged

Milestone: -

ghost avatar Sep 23 '22 15:09 ghost

Haven't investigated this at all yet, but I bet it's doing import/export stuff off the main thread. RC1 didn't install the browser sync context

lambdageek avatar Sep 24 '22 00:09 lambdageek

When I upgrade to .net 7 and UNO.UI 4.6.19, I get the following error:

The type initializer for 'System.Net.Http.BrowserHttpHandler' threw an exception

System. Net. Http. HttpClientHandler.. ctor () in D:\ a\ Uno. DotnetRuntime. WebAssembly\ Uno. DotnetRuntime. WebAssembly\ runtime\ src\ libraries\ System. Net. Http\ src\ System\ Net\ Http\ HttpClientHandler.cs: line 38 At System. Net. Http. HttpClient.. ctor () in D:\ a\ Uno. DotnetRuntime. WebAssembly\ Uno. DotnetRuntime. WebAssembly\ runtime\ src\ libraries\ System. Net. Http\ src\ System\ Net\ Http\ HttpClient.cs: line 140

It works fine on .net6.

kevin100702 avatar Nov 12 '22 01:11 kevin100702

@sarosigy I believe this is resolved, can you try with Uno.Wasm.Bootstrap 8.0.0-dev.280, make sure the wasm head is set to net8.0 and that you are using a recent version of Uno.WinUI.WebAssembly (5.0.0-dev.*)

ebariche avatar Sep 13 '23 17:09 ebariche

Still getting what looks like a similar error with a call to HttpClient (via Flurl)

System.TypeInitializationException: 'Call failed. The type initializer for 'System.Net.Http.BrowserHttpHandler' threw an exception: POST https://....etc'

Inner exception: System.Runtime.InteropServices.JavaScript.JSException:

'Error: Assert failed: Unknow converter for type Boolean (3) at 1 at generate_arg_marshal_to_cs (http://localhost:5000/package_a0f8a06beacb1f55cc99e1e0cabc0342f60bfdcd/dotnet.js:5:36322) at Object.mono_wasm_bind_js_function (http://localhost:5000/package_a0f8a06beacb1f55cc99e1e0cabc0342f60bfdcd/dotnet.js:5:79786) at _mono_wasm_bind_js_function (http://localhost:5000/package_a0f8a06beacb1f55cc99e1e0cabc0342f60bfdcd/dotnet.js:9464:70) at http://localhost:5000/package_a0f8a06beacb1f55cc99e1e0cabc0342f60bfdcd/dotnet.wasm:wasm-function[15722]:0x57e788 ...etc

This is with .net7.0, lastest stable uno.UI (4.10.26) and threading enabled.

The project uses threads so downgrade to .net6.0 wouldn't work and upgrade to .net8.0 is not working with an "Unreachable" error in js startup before even program.Main is ever reached.

Any suggestions on this? Is it the case that HttpClient never works or is it something specific to my code that I could reasonably spend time looking for a solution?

Rippletank avatar Oct 04 '23 14:10 Rippletank

@Rippletank this is only fixed in uno.wasm.bootstrap 8.0.0-dev.280 and later.

jeromelaban avatar Oct 04 '23 18:10 jeromelaban

@Rippletank this is only fixed in uno.wasm.bootstrap 8.0.0-dev.280 and later.

Thanks for the confirmation. Is there an existing discussion about uno for version 8? The template generated blank project doesn't fully launch for me when using .net8. Not sure where the appropriate place is to raise this.

Edit:. Net8 project works fine once all nuget packages are updated to latest dev/rc versions and as stated, HttpClient connects fine (CORS issues not withstanding)

Rippletank avatar Oct 05 '23 08:10 Rippletank