Skip to content

[browser][MT] support for NodeJS #92853

Open

Description

@elringus

With <WasmEnableThreads>true</WasmEnableThreads> generated dotnet.js has assert to only be used in browser environment. When imported (w/o actually creating the runtime), following error is thrown:

This build of dotnet is multi-threaded, it doesn't support shell environments like V8 or NodeJS.

This breaks unit testing in node when the dotnet APIs are mocked and the runtime is not initalized, but still has to be imported. After removing the assertion unit testing in node works fine.

Is it possible to remove the assertion or move it to the runtime creation function?

Activity

  1. ghost added
    needs-area-label
    on Sep 30, 2023
  2. ghost added
    untriaged
    on Sep 30, 2023
  3. added
    arch-wasm
    os-browser
    and removed
    untriaged
    on Oct 1, 2023
  4. added this to the 9.0.0 milestone on Oct 1, 2023
  5. pavelsavara commented on Oct 2, 2023

    @pavelsavara
    Member

    This is by design. What are the use cases which you need to address
    Oh, I miss-read the description

  6. pavelsavara commented on Oct 2, 2023

    @pavelsavara
    Member

    yeah, MT on NodeJS is not even close to ready. Why are you importing the module when you mock it anyway ?

  7. elringus commented on Oct 2, 2023

    @elringus
    ContributorAuthor

    I mock individual bindings, but not the whole module. Here is an example: https://github.com/Elringus/DotNetJS/blob/feat/revamp/Samples/App/test/computer.test.tsx (backend is the dotnet module).

  8. removed
    needs-area-label
    on Oct 3, 2023
  9. changed the title [-][browser] Oveprotective MT assert breaking fair usage in unit tests[/-] [+][browser][MT] support for NodeJS[/+] on Nov 7, 2023
  10. modified the milestones: 9.0.0, Future on Nov 9, 2023
  11. pavelsavara commented on Mar 28, 2024

    @pavelsavara
    Member

    This needs emscripten bump to 3.1.52

  12. lewing commented on Mar 28, 2024

    @lewing
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

arch-wasmarea-VM-threading-monoos-browser

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions