dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.95k stars 4.65k forks source link

[browser] JSMarshalAs(JSType.Function) support for Task #101913

Open kekekeks opened 4 months ago

kekekeks commented 4 months ago

We actively utilize JSType.Function for JS->managed callbacks and encountering problems when trying to add support for multithreaded mode: MT requires JS->managed calls to be async, however returning Task type doesn't work for JSType.Function:

Error SYSLIB1072 : The type 'System.Func' is not supported by source-generated JavaScript interop. The generated source will not handle marshalling of parameter 'callback'. For more information see https://aka.ms/dotnet-wasm-jsinterop

kekekeks commented 4 months ago

@pavelsavara