-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port cswinmd tooling #1190
Port cswinmd tooling #1190
Conversation
This sounds like a great idea! IDL for authoring components is not the greatest development experience (both in terms of IDE and tooling support), so hopefully this can make it easier for C++/WinRT devs. One thing that's probably worth exploring for a future revision is mixing with IDL, since some concepts aren't representable in C#, and to allow progressive migration to cswinmd. Apparently, currently everything runs before cppwinrt, so it should allow IDL to use types from cswinmd, but not cswinmd to use types from IDL. If we run cswinmd after, then the reverse applies (cswinmd can consume types from IDL, but IDL can't consume types from cswinmd). So maybe an option to determine when in the build order a C# file gets compiled would be nice. Even better would be going for a two-pass build , so that both worlds can consume from each other. But that's much harder to implement, most likely. |
For others: I was confused to see a C++ focused PR writeup for C# projections, so I asked Alexander for additional details to double-check my understanding. The gist is that developers prefer idiomatic experiences, especially when it comes to component authoring and metadata generation. That is, rather than write awkward IDL and pass it to MIDL(RT), you can write classes in C#, Rust, etc. and a ECMA-335 compliant blob pops out the other end. It is his belief that the C# authoring experience trumps the C++ IDL experience and provides a sample above. Shameless plug: Developers interested in a Rust idiomatic experience can also follow similar development here. |
This is the first PR to bring cswinmd over into this repo.
Description
CSWinMD is a tool to generate WinMD files from C#/WinRT .cs files (technically not valid C#, but C#-ish).
This can be used as a replacement to MIDL for producing WinMD files; instead of writing .idl, you'd write this C# syntax in your C++ project, reference the cswinmd nuget, and it would run cswinmd to generate the winmd from your C# files, and then pass the winmd to cppwinrt for it to generate component headers/sources.
Usage
Current state and future work
This is not yet a complete implementation (it suffers from the same expressivity limitations that C#/WinRT currently has, like no support for unsealed classes, etc.) however it starts laying the groundwork for a more complete solution.
Included in this:
For more context (internal to msft only) see my talk https://aka.ms/cswinmd/talk_2021