Chakracore: WASM - C# toolchain?

Created on 1 Nov 2016  路  12Comments  路  Source: chakra-core/ChakraCore

Hi, what is the state of C# -> WASM toolchain using Microsoft tools such as Visual Studio? Thanks.

External Question WebAssembly

Most helpful comment

Thank you for explanation!

@dilijev it makes sense not to use JavaScript on server yet here we are with Node.js! If developers want to use C# to build mobile apps (Xamarin) they will most definitely want to use it for web - given "first-class citizen" experience - not transpilers-over-transpilers.

@MikeHolman

C# is one of the languages that we will keep in mind when designing this feature.

Yes, it's important that C# needs are well-represented in WASM committee.

So it is possible or even likely that the community will come up with a solution.

I doubt community can create a nice well-integrated toolchain as it requires full IDE control. Besides the community has a terrible continuity problem, so corporate backing (paid maintainers) is paramount.

All 12 comments

Not aware of any plans for this functionality. (Marking as External because that would be owned by the C# team.)

@dilijev Yeah, and then C# team says it's not their problem and the LLVM team says it's not their problem either. It's not owned by anyone at Microsoft. Great, let's have the Edge support anyway - maybe someone will actually use it one day (along with the browser).

Devil's advocate: Given the low-level nature of WASM/Asm.js it makes more sense to compile a non-managed and low-level language like C++ to those low-level representations than it does to compile a managed language like C# to those low-level targets (and Emscripten is quite good at what it does for C++).

Even if it were trivial to do, there's a lot of stuff in even a logically simple C# application that would bloat the code size and execution time.

If multiple compiler implementations are saying that it doesn't seem like a good thing to spend their time on, it is probably that they see there being little value for customers at the cost of a lot of developer time. It makes more sense to spend that time on features that have more impact per dev hour. The story may change if a lot of people start desiring this functionality, so it's good to make your desire known even if they reject the idea right now. If enough people are looking for that functionality then it will be a higher-value feature and you would be more likely to see an implementation.

@dsaf In the longer term, we are planning on adding support for managed languages by exposing GC primitives. C# is one of the languages that we will keep in mind when designing this feature. This is all out of scope for the wasm MVP.

Until then, I have seen some community effort into this, e.g. https://github.com/kg/ilwasm. So it is possible or even likely that the community will come up with a solution.

Thank you for explanation!

@dilijev it makes sense not to use JavaScript on server yet here we are with Node.js! If developers want to use C# to build mobile apps (Xamarin) they will most definitely want to use it for web - given "first-class citizen" experience - not transpilers-over-transpilers.

@MikeHolman

C# is one of the languages that we will keep in mind when designing this feature.

Yes, it's important that C# needs are well-represented in WASM committee.

So it is possible or even likely that the community will come up with a solution.

I doubt community can create a nice well-integrated toolchain as it requires full IDE control. Besides the community has a terrible continuity problem, so corporate backing (paid maintainers) is paramount.

FWIW, there is an issue tracking codegen for WASM in the CoreCLR project. But again, it is blocked on the CG figuring out the GC support story. https://github.com/dotnet/coreclr/issues/5303

I think that even a community implementation, with any problems it has, will speed adoption by corporate-backed efforts. This seems like overall a good thing to me.

@MikeHolman mentioned we're planning to add engine-side support for GC primitives so we can support managed languages. With that I think any potential work items on our end for this question are covered, so I'll plan to close this Question soon (I'll leave it open for a couple more days for additional comments).

Sounds like ILWASM is C# to WASM via .NET IR, which is the equivalent of the Emscripten approach for C++ to asm.js via LLVM IR.

So, it seems like the effort is underway along multiple avenues and I'm excited to hear this. Looking forward to it!

Here is the link in the Wasm project talking about the future plan to add support for GC objects: [https://github.com/WebAssembly/design/blob/master/GC.md].

@LouisLaf thanks, seeing a recent activity in that section gives a hope for the future!

@LouisLaf I noticed that tooling is marked as high-priority after MVP and C# is mentioned there as well: https://github.com/WebAssembly/design/blob/master/Tooling.md

Give this guy(s) a raise:

WebAssembly development should be self-hosting, and not just as a cute hack but as enjoyable platform that developers actively seek out because the tools they want and need just work. Developers have high expectations, and meeting these expectations on tooling means WebAssembly has the features required to build rich applications for non-developers.

Xamarin team has a plan I think-
https://github.com/xamarin/WebSharp#future-work

Looks like this question is answered and there's no action to take on our end. Closing this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aneeshdk picture aneeshdk  路  4Comments

gustavopinto picture gustavopinto  路  3Comments

Kureev picture Kureev  路  5Comments

obastemur picture obastemur  路  4Comments

crdumoul picture crdumoul  路  4Comments