-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ReactiveUI.Uno] WebAssembly RxApp.TaskpoolScheduler should return WasmScheduler #1
Comments
@HavenDV what would you want this property to do? What's your workaround, with an example? |
At the moment, I am using the solution via DI: _ = services
// WebAssembly does not support Threads for .Net5/.Net6 now.
.AddSingleton(static provider =>
{
return provider.GetRequiredService<Platform>() switch
{
Platform.WebAssembly => RxApp.MainThreadScheduler,
_ => RxApp.TaskpoolScheduler,
};
}) and explicitly get and pass taskPoolScheduler in code. I see the solution through detecting the WebAssembly platform at a platform agnostic level (Inside the main ReactiveUI package targeting .Net Standard 2.0) and returning the correct TaskPoolScheduler (RxApp.MainThreadScheduler) for the WebAssembly platform. |
If I understand everything correctly, should I use this package at the platform level? Which causes the same difficulties, because our Core package with all ViewModels (and the code that uses specific Scheduler) targets the same as the main ReactiveUI package |
Just your views project, based on having ReactiveUI.Uno it'll run the registration in that project and should set it to a WasmScheduler. |
From my point of view, the ReactiveUI.Uno package should do this on its own. Or there must be some documentation about it because I didn't notice anything about it until I heard from you. |
Yeah that's what it should do, if it's not its a bug. What is TaskPoolScheduler by default before you do your override? |
I'm trying to find out. I still haven't figured out how to use Debugger with a WASM project. |
I added this to the App constructor of the Uno application: public App()
{
Console.WriteLine(RxApp.TaskpoolScheduler);
#if __WASM__
PlatformEnlightenmentProvider.Current.EnableWasm();
#endif
Console.WriteLine(RxApp.TaskpoolScheduler);
Console.WriteLine(System.Reactive.Concurrency.WasmScheduler.Default); |
Ok yeah, this will have to be fixed then. I'll see if we can get a point release next release. |
Currently, multithreading is not supported in WebAssembly.
When developing for Uno, at the moment I have to explicitly override TaskPoolScheduler so that the code works on all platforms.
The text was updated successfully, but these errors were encountered: