Separate The .NET Core to WASM Experience from Blazor
Please consider separating the UI-specific parts of this project from the basic capability to compile .NET Core code to WASM. There are many scenarios where it would be an advantage to run C# code without needing a full UI framework (or this framework).
Minimally, I would expect the compilation process to produce:
- The WASM module
- A JavaScript module with a series of exports corresponding to WASM module function exports
- A TypeScript d.ts file which describes the WASM module function exports
The combination of the above allows consumers to call the compiled code in a type-safe way from JavaScript or TypeScript.
This seems like a 1st step that we would want to get right, before proceeding on to building a full UI framework. It's an important step in democratizing the .NET ecosystem so that anyone can build frameworks, not just Microsoft.
Hi @EisenbergEffect! The core WebAssembly work is actually being handled by the Mono team. We are building Blazor on top of what they provide. Others in the .NET community are free to do so as well and several already are (Ooui, Uno, cshtml5). You can follow along with the progress on mono.wasm in the Mono repo.
I'm very much not interested in compiling Mono to WebAssembly. I'm only interested in .NET Core. What I'm asking for is something like this:
- Use the .NET CLI to create a .NET Core C# project.
- Use the .NET CLI to compile my .NET Core project to WASM, having the 3 outputs described above.
@danroth27 Is that supported today?
The Mono folks are also working on full ahead of time (AoT) compilation of .NET code to WebAssembly along with the supporting MSBuild SDK. The last update they published on the effort was http://www.mono-project.com/news/2018/01/16/mono-static-webassembly-compilation/. @mhutch is probably the best contact for getting the latest status.
I'm not interested in Mono. I'm interested in .NET Core only. Is there a story for .NET Core WASM?
Is there a story for .NET Core WASM?
Not currently. .NET Core is primarily used today for cross-platform server scenarios. Mono is the .NET runtime used today for cross-platform client scenarios (Android, iOS, macOS, gaming). Most WebAssembly scenarios today are client scenarios, so Mono is the cheapest way forward right now. Over time it's reasonable to expect there will be a convergence, but that will take some time.
FWIW I really think this issue of runtimes and platform targets needs to be addressed first. When I hear that I have to use two different flavors of .NET to build an app...use Mono for your client and then use .NET Core for your server...it doesn't get me excited at all. I just want to use .NET Core, and frankly, forget that any other .NETs exist. One .NET please :)
@EisenbergEffect from the consuming perspective it should be pretty much an implementation detail which runtime is running your code.
I disagree. Never in my history of being a software engineer have I considered which run-time is running my code to be an implementation detail I can ignore.
@danroth27 Just some feedback from my development team, we also would like to see Blazor use .NET Core eventually. We are not interested in Mono or even the full .NET framework. We want the same runtime on client and server.
We are not interested in Mono or even the full .NET framework. We want the same runtime on client and server.
Well, no matter what we do you won't have exactly the same runtime on the server and in the browser: the browser runtime needs to be WebAssembly based, but the server one does not. It's not unlike how running on iOS is fundamentally different that running on the server. The unifying factor on the client and server is .NET Standard. That said, I think we share your goal of wanting to unify on a single runtime impementation. It doesn't make sense for Microsoft in the long run to own and maintain two runtimes at twice the price. Convergence work is already happening in many ways. More and more of the code in Mono and .NET Core is shared. But getting to a single runtime is still a major effort that will take some time.
In the meantime Blazor is an experiment and we are experimenting with what can be made to work today 😃
@danroth27 Thanks for the excellent response, Dan!
Excellent totally agree
On Tue, May 15, 2018, 10:54 AM paulost [email protected] wrote:
@danroth27 https://github.com/danroth27 Thanks for the excellent response, Dan!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/aspnet/Blazor/issues/835#issuecomment-389046589, or mute the thread https://github.com/notifications/unsubscribe-auth/ACnwPz_cCiVg6iti9VR9pQWY34_Hibf4ks5tymapgaJpZM4T-jpA .
@EisenbergEffect I had similar view on Mono, however when I learned that since Microsoft acquired Xamarine, Mono is Microsoft tech... And is optimized for client scenarios... And I can use it to run my ".net standard" code inside browser today... All concerns were brushed aside.
To grab browser runtime only components: https://jenkins.mono-project.com/job/test-mono-mainline-wasm/label=ubuntu-1804-amd64/
... Now I get back to building my own XAML based UI stack in C# targeting WebGL
To be clear, it's not about using non-Microsoft tech. It's about wanting to use only .NET Core. I'm looking for one, open source, cross-platform .NET with a unified cross-plat CLI. Not two or three .NETs or multiple compilers. I would have thought that new efforts would be focused around .NET Core and unification, so I found it surprising that WASM was only for Mono and required a different toolchain.
I've personally been asking for unification in the .NET platform for over 10 years. So, forgive me if I'm a bit agitated in this thread, since after 10 years I still need 3 .NETs to build my services and clients. There are very few things I'm willing to wait 10 years for. I left .NET several years ago and since December have been looking back into it to see if the situation has improved. I'm more than a little disheartened to find many of the same issues I left behind, still lingering.
I mean this with all sincerity, I want to love .NET again. Please, take this seriously.
I mean this with all sincerity, I want to love .NET again. Please, take this seriously.
We are taking this issue seriously and we are actively working on convergence of the various .NET runtimes. But it will take time, and we may very well decide that in the short term due to practical considerations it makes sense to proceed with Mono with a longer roadmap for convergence with .NET Core.
I still need 3 .NETs to build my services and clients
I assume the three .NET's you are referring to are .NET Framework, .NET Core and Mono. The good news is that we announced at BUILD that .NET Core 3 will have support for Windows desktop applications, so hopefully that will reduce the need for one of those runtimes and provides further evidence that convergence is our common goal.
FWIW, Mono has already switched to the Roslyn compiler and the msbuild build system, so it's not really a different toolchain. You can build .Net Core and Mono-based projects in a single solution, with the same build system and compiler. Mono is also using large and ever increasing parts of the .NET Core classlibs.
WASM is a pretty unusual target. Not only is it not possible to JIT compile, things like threading, file, and sockets have very different models to most other platforms. Mono has many existing technologies developed for ports to other unusual/constrained platforms like iOS, watchOS, PS4, etc that help with the WASM port, such as the IL interpreter, cooperative GC suspend, Full AOT (surprisingly hard for generics) with generics sharing, LLVM bitcode backend, and managed linking.
I fully expect Mono's WASM project type to use SDK-style projects, with a MSBuild SDK delivered via NuGet, and usable from dotnet.
I think I smell some Mono hate here, no? Please do not be so quick to want to throw Mono out. Remember when Microsoft had no love for Linux? Mono was there for C# devs. Remember when Microsoft had no love for Mac OS? Mono was there again. Now JavaScript is eating our lunches, guess who shows up? You bet, Mono is here to save the day, being the first full .net to run on Wasm. Please show some respect!
Listen, we C# devs over this side love Mono. They are doing a fantastic job. Leave Mono alone. If cool kid .Net Core wants to party, that’s fine too, BUT MONO STAYS!
@humbersoft If you want a reason why we "hate" Mono I'll give you one. It's seeing errors like this in your browser console: "WASM: It should have been installed in the `/Users/builder/jenkins/workspace/test-mono-mainline-webassembly/label/highsierra/sdks/out/wasm-interp/lib/mono/4.5/mscorlib.dll' directory." Who is jenkins? What a bizarre message! A Mono dev evidently hard-coded his/her personal path in the runtime.
@paulost Jenkins is a continuous build service. Search for it. It's very popular.
Thanks @MisinformedDNA but why is Mono telling me that it should be installed in that exact path on my system? I am not trying to build Mono but only use it to run a blazor app. A shipped runtime shouldn't tell you about its build service path.