blazor runtime question

김대근 1 Reputation point
2021-06-13T17:50:13.417+00:00

Is dotnet.wasm, the runtime of blazor, mono? Or did you make it yourself as part of the dotnet core?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,208 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,126 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Zhi Lv - MSFT 32,021 Reputation points Microsoft Vendor
    2021-06-15T06:07:12.073+00:00

    Hi @김대근 ,

    Is dotnet.wasm, the runtime of blazor, mono? Or did you make it yourself as part of the dotnet core?

    Please refer the official document, the software development kit (SDK) includes everything you need to build and run .NET Core applications, using command-line tools and any editor (like Visual Studio). And the asp.net core runtime includes everything you need to run .NET Core applications. The runtime is also included in the SDK.

    Blazor WebAssembly is a single-page app (SPA) framework for building interactive client-side web apps with .NET, it is not the runtime of the Blazor. When a Blazor WebAssembly app is built and run in a browser:

    • C# code files and Razor files are compiled into .NET assemblies.
    • The assemblies and the .NET runtime are downloaded to the browser.
    • Blazor WebAssembly bootstraps the .NET runtime and configures the runtime to load the assemblies for the app. The Blazor WebAssembly runtime uses JavaScript interop to handle DOM manipulation and browser API calls.

    More detail information, see Blazor WebAssembly.


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards,
    Dillion

    0 comments No comments

  2. Bruce (SqlWork.com) 56,931 Reputation points
    2021-06-15T16:23:19.183+00:00

    it is the mono WASM assembly.

    The Blazor/mono approach is different from most WASM cross compilers. Typically a LLVM compiler is used to create a native WASM assembly. But rather than C# producing a WASM assembly, a .net WASM was produced that can run the IL code produced by a C# compiler. Javascript loads the WASM assembly. Javascript then passes IL code (.net dll) to the WASM assembly and the WASM assembly runs it. This means Blazor WASM apps are interpreted and not JIT Compiled.

    As a LLVN compiler must be used to produce a WASM assembly, the mono IL WASM vm is used as it was written with a LLVM c/c++ compiler and does not require thread support.

    The Blazor supporting libraries are written in C# and use the roslyn compiler, not the mono compiler. It is these runtime libraries (written in c#) that makes it compatible with net 5/6 libraries.

    some of the blazor wasm runtime library support actually depends on javascript, as WASM apps runs in a sandbox. network, timer and dom access must be done via javascript. for example, the HttpClient library has to use javascript interop to make an actual network call.

    also, currently thread support in WASM is experimental, so the Blazor WASM does not have true thread support. thread support is pretty key to the Microsoft .net JIT compiler and IL runtime. For example the GC runs on a thread.


  3. 김대근 1 Reputation point
    2021-06-21T06:42:59.367+00:00

    In a hurry with a translator? I think my question was misrepresented if you translate it.

    What I was trying to ask was...

    Is the dotnet.wasm file that allows the blazor app to run based on dotnet clr on dotnet core? Or, I was wondering if it was made of a mono base.

    0 comments No comments

  4. Zhi Lv - MSFT 32,021 Reputation points Microsoft Vendor
    2021-06-25T05:44:16.903+00:00

    Hi @김대근 ,

    You can refer this blog:

    The default experience for most .NET 5 workloads will be using the JIT-based CoreCLR runtime. The two notable exceptions are iOS and client-side Blazor (web assembly) since both require ahead-of-time (AOT) native compilation.

    The Blazor project is already using the Mono AOT. It will be one of the first projects to transition to .NET 5. We are using it as one of the scenarios to prove out this plan.


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards,
    Dillion