WASI Will Change .NET Forever! Run WebAssembly Outside The Browser!

Ғылым және технология

Wasm (WebAssembly) changed the game enabling C# and other programming languages to run directly in the browser. For .NET developers never having to write JavaScript again was a dream and with Blazor and it's component based approach and full Wasm support it has flourished. Now, the next generation of Wasm support is coming with WASI, the WebAssembly System Interface. WASI enables developers to take their Wasm code to run outside the browser and just about anywhere. Let's give the new .NET 8 experimental support a go!
Links:
Rich's Post: devblogs.microsoft.com/dotnet...
Research Resources:
WASI : wasi.dev
Wiki: en.wikipedia.org/wiki/WebAsse...
WASI GitHub: github.com/WebAssembly/WASI
Mozilla Blog: hacks.mozilla.org/2019/03/sta...
WebAssembly on the Server: learn.microsoft.com/en-us/eve...
Wasm by example: wasmbyexample.dev/examples/wa...
Chapters:
00:00 - Intro
00:43 - What is WebAssembly?
01:55 - What is WebAssembly System Interface (WASI)?
03:34 - Installing WASI Experimental .NET Workload
04:15 - Creating our first .NET WASI App
09:00 - Wrap-up
Using links I provide I may receive a commission if you buy something which helps support the channel.
Join this channel to get access to perks:
/ @jamesmontemagno
👕 Buy some swag! - jamesmontemagno.myspreadshop....
☕️ Buy me a coffee - www.buymeacoffee.com/jamesmon...
Follow:
👨‍💻 GitHub: github.com/jamesmontemagno
🦜 Twitter: / jamesmontemagno
📄 Website: www.montemagno.com
📰 Newsletter: newsletter.montemagno.com/
Disclaimer: This channel, videos, and streams are created in my spare time and are a product of me... James Montemagno! They are NOT officially affiliated or endorsed by Microsoft (my employer) in any way. Opinions and views are my own.
What is on my hat? It is the CLE clothing logo because I am from Cleveland! Checkout their awesome CLE merch: cleclothingco.myshopify.com/
What is that art on my wall? It is an original piece from the French street artist Gregos of La Butte Montmartre: / bcez1onhiqx
My Setup:
📷 Canon M50 Mark II - amzn.to/3P8R7lp
💡 Nanoleaf Elements Lights - amzn.to/3umwJVW
🎙 Blue Spark Microphone - amzn.to/3qgtYkq
🎙 Blue Pop Filter - amzn.to/3jEWM3r
🤳 Rode Microphone Arm - amzn.to/2Z68AlE
🎧 Sony MDR7306 Headphones - amzn.to/372jxta
📲 Stream Deck - amzn.to/373Uk1n
🖱 MX Master 2S Mouse - amzn.to/3d7J2gj
⌨️ Tecware Phantom Keyboard - amzn.to/3aUP4y9
#dotnet #webassembly #wasi #blazor #visualstudio #csharp

Пікірлер: 47

  • @JamesMontemagno
    @JamesMontemagno7 ай бұрын

    Thanks for all the great comments and questions. I will pin this to help answer some of them. When it comes to Wasm and WASI I look at it less of UI and more about libraries, small programs, and just logic/functions that I want to be able to run anywhere or inside of other programming languages that support WASI. Now you may be saying well .NET runs pretty much anywhere.. yes, that is true, but there are always new OSes, distros, PaaS platforms, embedded systems, and new runtimes/programming languages. That means for example you could take your .NET code compiled to wasm and run it in Hippo, a WebAssembly PaaS platform: github.com/deislabs/hippo, or you could take it and run it inside of a Swift or Rust application. The reverse is true as well being able to now take modules written in other languages and embed them into your .NET app. Hyperlight is an example of a Wasm-enabled cloud that could spin up super lightweight and secure hypervisors near instantly. (kzread.info/dash/bejne/hq5mtbGje73dhqQ.html). The best part here is to run these wasm modules anywhere you don't need a .NET runtime, a .NET host, or even an OS or programming language that supports .NET/C#, you can just execute it with the Wasm Host... in the case of what I showed is wasmtime. These are pretty advanced scenarios that maybe aren't for everyone, but to me it is exciting to see .NET part of this journey into cutting edge technologies. Here are some more links to dive through: Rich's blog: devblogs.microsoft.com/dotnet/extending-web-assembly-to-the-cloud/ Merge Conflict: kzread.info/dash/bejne/aZxktdefd6_ej9o.html

  • @HomeSlize
    @HomeSlize7 ай бұрын

    Awesome! Now I have something to tinker with over the weekend. Thanks for sharing.

  • @JuanDevelop
    @JuanDevelop7 ай бұрын

    Good to see you sharing amazing things. By the way, Merry Christmas

  • @JamesMontemagno

    @JamesMontemagno

    7 ай бұрын

    Happy holidays!

  • @njbrad007
    @njbrad0077 ай бұрын

    Mind blown, before the 30 second mark!!

  • @LWAzure
    @LWAzure7 ай бұрын

    Thus looks interesting mate :-)

  • @dotnetdevni
    @dotnetdevni7 ай бұрын

    Finally james has the senior dev hair cut :-) welcome to club man 👨

  • @micheladey
    @micheladey6 ай бұрын

    Great video! Is it possible to have a Blazor frontend running with a Wasi server using the Blazor SSR model ?

  • @LeonardHarrisLH
    @LeonardHarrisLH7 ай бұрын

    A video should be done on Maui vs Maui blazor vs, Blazor Server, Blazor wasm and now Blazor web apps in net 8? We need a video to cover all these things? Maui and blazor

  • @wvvwwwvvw
    @wvvwwwvvw7 ай бұрын

    Soooo, could you also have code that listens for COM port data received and pass it on to the browser?!

  • @mahdi8572
    @mahdi85727 ай бұрын

    I tried to use c# dev kit once, why does it like to put opening braces on the same line by default? and I couldn't find an easy way to disable that behavior 🤷‍♂

  • @ulrich-tonmoy
    @ulrich-tonmoy7 ай бұрын

    so like jvm + docker like concept whats the performance difference with the native

  • @JamesMontemagno

    @JamesMontemagno

    7 ай бұрын

    A bit different. With containers you have like host os, runtime, dependencies, etc. wasm hosts are a bit like containerd in this instance.

  • @adamstraughan3861
    @adamstraughan38617 ай бұрын

    I assumed the whole point is, i can write a useful package/library in any language that compiles to the WASI standard and use it in any other WA host. I'm less convinced by writing a single program in one language this was unless the target was WASI only, or somehow was not an existing dotnet target

  • @JamesMontemagno

    @JamesMontemagno

    7 ай бұрын

    Yea both of these are valid!

  • @austenfrostad7675
    @austenfrostad76755 ай бұрын

    @6:10 Wasitime is available for a bunch of platforms. Dotnet Runtime is available for a bunch of platforms. I understand there is some perks to using wasm, like a blazor app can be ran as a desktop app, but why compile an app that is not for browsers to wasm? That is what this video has me wondering. Any insights!?

  • @user-hr4ve8ne4h
    @user-hr4ve8ne4h7 ай бұрын

    Where did Visual Studio 2022 go?

  • @JamesMontemagno

    @JamesMontemagno

    7 ай бұрын

    I is both VS and VSC every day.

  • @brianchipendo3132
    @brianchipendo31327 ай бұрын

    Great now I that I can take my C# code anywhere. No more limitations, many posssibities

  • @Chris-zb5nm

    @Chris-zb5nm

    7 ай бұрын

    OMG, dotnet can already run everywhere like more than 10 years.

  • @programmerstalks7196
    @programmerstalks71967 ай бұрын

    When we will MAUI mind blowing release come out to happy our customer for their app which already migrate from xamarin to maui , but most of the issue still in progress due lack of perfect releases. No need to worry about them, I told you just to know whats your end user wants in your technology updates and fixes... Happy Weekends

  • @youdiegocardosotube
    @youdiegocardosotube7 ай бұрын

    Ok but what’s the advantage to use is instead of the .NET framework directly. I thought you could create a shared UI running into the browser and the host OS. I think it will possible in the future. Isn’t?

  • @JamesMontemagno

    @JamesMontemagno

    7 ай бұрын

    This isn’t really about UIs, it is about taking the logic, functions, ect. And making it portable to run anywhere now that wasm modules can run including inside of other programming languages and runtimes that support wasi

  • @serratedsharp4854
    @serratedsharp48547 ай бұрын

    It doesn't look useful when you think only about the .NET ecosystem. However, we are often dependent on non .NET tooling, and building those tools in .NET has never made sense because they wouldn't have the support of the broader community that something like an NPM package has. Secondly, there's a lot of redundancy in implementations across language ecosystems. We will be able to build packages that have a much wider audience and in turn be able to consume tooling/packages from other languages with greater ease without the burden of their runtimes. .NET will also make more sense for building tools that potentially have a wider audience beyond the boundary of the .NET ecosystem. How many of the same logic/tools/libraries exists in many different languages redundantly due to lack of interoperability?

  • @muaadeeb9625
    @muaadeeb96257 ай бұрын

    Love it! Any chance for a demo app?

  • @JamesMontemagno

    @JamesMontemagno

    7 ай бұрын

    What do you want to see. Check the blog for good examples

  • @PticostaricaGS
    @PticostaricaGS7 ай бұрын

    Is WASI already official or is it still experimental?

  • @JamesMontemagno

    @JamesMontemagno

    7 ай бұрын

    Experimental. The interface itself is still getting speced out. Read the blog I linked to.

  • @flibbertigibbet6324

    @flibbertigibbet6324

    6 ай бұрын

    The WASI industry has reinvented itself over the past year and rebased its thinking around WASM components, this is called the Preview-2 release. The difference between Preview-1 and Preview-2 is major with the spec expected to be locked down Jan/Feb 2024.

  • @kreont1
    @kreont13 ай бұрын

    Im failed when use "dotnet run" -- WasmAppHost --runtime-config d:\temp\WASI\bin\Debug et8.0\wasi-wasm\AppBundle\WASI.runtimeconfig.json Error: Cannot find host wasmtime: Tried to look for wasmtime.exe, wasmtime.cmd, wasmtime.bat in PATH: C:\Windows\system32, C:\Windows, C:\Windows\System32\Wbem, C:\Windows\System32\WindowsPowerShell\v1.0\, C:\Windows\System32\OpenSSH\, C:\Program Files\dotnet\, C:\Program Files (x86)\Microsoft SQL Server\160\DTS\Binn\, C:\Users\KPU24\AppData\Local\Microsoft\WindowsApps, C:\Users\KPU24\.dotnet\tools . What to do ???

  • @facts247
    @facts2477 ай бұрын

    what about UI? visual apps are everything

  • @JamesMontemagno

    @JamesMontemagno

    7 ай бұрын

    Lots of options if you need UI: .NET MAUI, Uno, Avalonia, Blazor…

  • @user-hr4ve8ne4h
    @user-hr4ve8ne4h7 ай бұрын

    I don't see the point of it at the moment.

  • @JamesMontemagno

    @JamesMontemagno

    7 ай бұрын

    Run .NET Anywhere without .NET being required.. great for all sorts of scenarios, small little functions, embedded, http servers, you name it

  • @WDGKuurama

    @WDGKuurama

    7 ай бұрын

    ​@@JamesMontemagnobut the runtime to run the webassembly is required too, what's the real deal about replacing the dotnet runtime with another one that might be slower? It's already cross platform.

  • @modernkennnern

    @modernkennnern

    7 ай бұрын

    The dream is for you to have full interop across all languages. If all you're doing is writing AspNetCore APIs using C# there's little-to-no reason to use WASI. Although, even then you can see reasons to use it. Some languages are built around solving specific tasks. Take Python for example. Python is famous for data science (why? I don't know, but let's stick with it for now), so if you wanted some data science-y thing in your AspNetCore API then wouldn't you love to use Python for that specific aspect? That's where WASI comes in. It's basically microservices with less of the annoyances that comes with orchestration.

  • @serratedsharp4854

    @serratedsharp4854

    7 ай бұрын

    ​​@@WDGKuuramaConsider just as an example a build server for any language. Often it has to have a variety of tools from disparate languages and runtime dependencies. It's fragile and you have to virtually be an expert in all of them to troubleshoot errors. If all of the tooling is instead compiled to WASM, then you only need one runtime instead of many. There's a variety of other benefits of the WASM packages being self contained and achieving better encapsulation and interoperability. It's easy to armchair quarterback this and dismiss it with a hand wave. It's more nuanced if you look at specific usage scenarios where it would be more appropriate. I'd love not to have NPM packages compiling locally from source, or deal with both python and nodejs runtimes as part of my build tooling.

  • @WDGKuurama

    @WDGKuurama

    7 ай бұрын

    @@serratedsharp4854 i see, even though i don't think i will make much use of this before at least 10 years X)

  • @queenstownswords
    @queenstownswords7 ай бұрын

    What is the use case for AOT vs WASI?

  • @JamesMontemagno

    @JamesMontemagno

    7 ай бұрын

    You can AOT Wasi!!!!!!!! Whoa! I mean AOT is just for specific platforms.

  • @PeacefulMindss
    @PeacefulMindss7 ай бұрын

    I hoped for MAUI to run on the browser, they gave us this!, what's wrong with them.

  • @JamesMontemagno

    @JamesMontemagno

    7 ай бұрын

    These are very different things

  • @Chris-zb5nm
    @Chris-zb5nm7 ай бұрын

    Sorry but your video is confusing everybody as you can see in the comments. What's the porpuse of this now? Why would I work with this when I can just use the normal Console,WPF, etc. application? There must always be a runtime installed on the target machine to run the application whether it's Java, Python, Dotnet or whatever. You even yourself installed it in this video!

  • @JamesMontemagno

    @JamesMontemagno

    7 ай бұрын

    To developer yes I need to have the .NET SDK, when I compile down to wasm I get a wasm module that can be executed anywhere wasm can run. And now through WASI and host such as wasitime that is anywhere basically. This means more places and opportunities to run you .net code. No .net runtime needed in this case

  • @JamesMontemagno

    @JamesMontemagno

    7 ай бұрын

    It also means that you can take any wasm module and load it up into other programming languages and run it there too. For example you could take a wasm module written in rust and run it inside of your .net app

  • @petrkomarek7249

    @petrkomarek7249

    7 ай бұрын

    ​@@JamesMontemagno It would be really interesting to see an example. What would be the signature and data types of such shared methods/functions ? I mean for example nullable types, collections ....

Келесі