core
core copied to clipboard
WS Compiler: calls to Async.RunSynchronously prevent it from working in Wasm or Blazor
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.
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.
Thank you.
Could we just make it all Async
return and call Asyn.Start
?