Coder Social home page Coder Social logo

Comments (10)

jeromelaban avatar jeromelaban commented on May 5, 2024 1

@HavenDV what would you want this property to do? What's your workaround, with an example?

from reactiveui.uno.

glennawatson avatar glennawatson commented on May 5, 2024 1

Ok yeah, this will have to be fixed then.

I'll see if we can get a point release next release.

from reactiveui.uno.

HavenDV avatar HavenDV commented on May 5, 2024

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.
Platform is explicitly specified in Shared code through #ifdef instructions.

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.
The main difficulty is in detecting WebAssembly.

from reactiveui.uno.

glennawatson avatar glennawatson commented on May 5, 2024

are you using ReactiveUI.Uno nuget package, It's meant to go the WasmScheduler if it's netstandard2.0

https://github.com/reactiveui/Reactive.Wasm/blob/master/src/System.Reactive.Wasm/Internal/WasmScheduler.cs

GitHub
A Web Assembly versions of the System.Reactive classes. - Reactive.Wasm/WasmScheduler.cs at master ยท reactiveui/Reactive.Wasm

from reactiveui.uno.

HavenDV avatar HavenDV commented on May 5, 2024

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

from reactiveui.uno.

glennawatson avatar glennawatson commented on May 5, 2024

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 reactiveui.uno.

HavenDV avatar HavenDV commented on May 5, 2024

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.

from reactiveui.uno.

glennawatson avatar glennawatson commented on May 5, 2024

Yeah that's what it should do, if it's not its a bug.

What is TaskPoolScheduler by default before you do your override?

from reactiveui.uno.

HavenDV avatar HavenDV commented on May 5, 2024

I'm trying to find out. I still haven't figured out how to use Debugger with a WASM project.

from reactiveui.uno.

HavenDV avatar HavenDV commented on May 5, 2024

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);

image

from reactiveui.uno.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.