core icon indicating copy to clipboard operation
core copied to clipboard

WS Compiler: calls to Async.RunSynchronously prevent it from working in Wasm or Blazor

Open amieres opened this issue 5 years ago • 2 comments

Right now Mono-WASM/Blazor do not support multiple threads in the ThreadPool. That causes calls to Async.RunSynchronously to hang forever.

There are a couple of places in the compiler where it is used:

https://github.com/dotnet-websharper/core/blob/master/src/compiler/WebSharper.FSharp/Program.fs#L76

https://github.com/dotnet-websharper/core/blob/master/src/compiler/WebSharper.Compiler.FSharp/Main.fs#L61

Removing them would presumably allow the compiler to run in Blazor/WASM.

amieres avatar Feb 23 '20 03:02 amieres

Thanks for testing this. Yes, https://tryfsharp.fsbolero.io/ uses some workarounds for this too https://github.com/fsbolero/TryFSharpOnWasm/blob/master/src/WebFsc.Client/Autocomplete.fs#L40 I don't really like the idea of introducing a busy waiter for the .NET version just for Mono-wasm releases but maybe we can have a custom build just for use with Blazor. I will get back to this.

Jand42 avatar Feb 23 '20 13:02 Jand42

Thank you. Could we just make it all Async return and call Asyn.Start?

amieres avatar Feb 23 '20 13:02 amieres