-
Notifications
You must be signed in to change notification settings - Fork 69
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
Thoughts on Windows 11 C# Windows App SDK WinUI 3 XAML #164
Comments
Hi @kaidelorenzo! Thanks for the questions.
There are a few things that depend on the custom type gen in #145, so it's relatively likely we'll start investigating options there pretty soon. |
I haven't given much thought to what limitations would be acceptable. I've read online that the interop between c# and rust isn't great right now so that might make things more challenge. My goal would probably be minimal typegen support so that it is possible to run the framework even if the data types sent are simple (maybe restrict to integer or string structs only). I don't have much time right now to work on this but glad that you'd be open to contributions. To me Windows seems like the last native platform that doesn't already work with crux. |
One problem for which I can't see an immediate solution is representing Rust enum's, which are quite central to how Crux communicates with the shells (for events and effects). We'd need to do something like this probably https://bugsquash.blogspot.com/2012/01/encoding-algebraic-data-types-in-c.html. I'm not very familiar with the windows ecosystem, but maybe it would make more sense to target F# and rely on its interop with C# if that's more mature? @StuartHarris Do you know much about the state of interop in C# land? |
I don't. But I'm putting this link here mainly so I can find it again to do a bit more reading on it. https://github.com/FractalFir/rustc_codegen_clr |
👋 with windows-rs and WinRT components you can integrate Rust into a C#/WinUI 3 or any WinRT based application. it's pretty simple outside of having to conform to the quirks of WinRT on implementation, works well. depends on CsWinRT (to generate the c# bindings) and Visual Studio (for midlrt.exe to generate .winmd which is then used to generate both Rust implementation and C# projection bindings). i can share an example with C# & WinUI if anyone's interested. I should probably mention I only got started like 3-4 days developing on Windows, so not much of an expert 🤣, in fact spent 7+ hours trying to get it to work 🤣, but eventually did. |
Yeah an example would be great. No rush if you'd rather tidy up some code first or something |
Screen.Recording.2024-07-06.at.03.04.32.movthought might as well get crux also working 😭 spent entire day, but !! works. should clarify nothing was generally complicated, it's just my inexperience with C# as a language, and Windows as a platform. As well as getting familiar with how Crux does typegen. And how to implement state in WinUI 3. given as i mentioned above i only started 3-4 days ago. |
I'm wondering about 2 things
The text was updated successfully, but these errors were encountered: