-
Notifications
You must be signed in to change notification settings - Fork 511
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
Issues using WinUI with winrt-rs #233
Comments
Hi Joe, thanks for reaching out. Regarding (1) I can confirm that the DLL is not copied automatically by Regarding (2) I'm not sure how we'd detect such a dependency. Note that the VCRTForwarders should only be used for compat with legacy DLLs originally designed for store apps. WinUI should not depend on these. @jevansaks from the WinUI team to comment. Hopefully WinUI 3 has no such dependency and simply uses the standard static CRT to avoid dependency hell. There are a few known issues with type system support in winrt-rs that I'm working on right now that will be needed to support all Xaml-style composable WinRT types. I should have all of the type system issues ironed out in a week or two. Note that full Xaml support requires the ability to implement and derive from existing WinRT types and that's still going to be a while but I am working on it. #81 |
Kenny, thanks for the quick feedback. For (2), I only figured out why Microsoft.UI.Xaml.dll wasn't loading by using procmon to see what paths were being looked for. I originally found the missing dlls in: I am eagerly waiting for #81 as there are some other ideas I want to try that depend on it. |
We are actively discussing how to handle the CRT linkage for WinUI 3.0. Static is convenient, but is dll bloat. For now the VCRTForwarders nuget package approach is the right solution for unpackaged apps. I don't know enough about the cargo packaging to say why the dll isn't copied forward. The crash at runtime is likely because you are missing resources for your app. In particular MRT is looking to load resources from a resources.pri near the app. Again, the use of MRT in unpackaged apps is something we're also discussing how to address for WinUI 3.0. Is packaging the app a possibility for this experiment? The Windows Application Packaging project in VS might be usable here -- unless we're trying to avoid VS tools entirely? |
The VCRT Forwarders is a workaround until the VC team fix their libs. Which CRT you use is up to you, but the point here is that this dependency is opaque to developers that don't happen to be writing a C# app or the very few C++ apps using msbuild, which can presumably figure this out. Increasingly, developers are building apps for Windows using something other than Visual Studio and msbuild. They are already having to download the WinUI nuget package as a zip file and extract the dependencies, but reverse-engineering msbuild itself is a bit much. If components can simply include their dependencies (e.g. whatever CRT you choose) then projects can simply consume WinRT components like WinUI, whether that project is using cmake or cargo or something else entirely. |
Issues on the winrt-rs side should now all be addressed. Let us know if you have any more issues. |
I am attempting to use a WinUI control via Xaml Islands and winrt-rs. I can get the windows::ui::xaml::controls to work however I ran into a number of issues with microsoft::ui::xaml::controls.
target/debug
automatically bycargo winrt install
. It is downloaded totarget/nuget/Microsoft.UI.Xaml/win10-x64/
. Dlls from other NuGet packages do get copied as expected. I manually copied it to move forward.HRESULT 0x80040154
I received before I copied Microsoft.UI.Xaml.dll. I am not sure ifcargo winrt
can detect this situation and provide the user with additional feedback because it was very confusing at first. I added the VCRTForwarders to[package.metadata.winrt.dependencies]
. The dlls were downloaded intotarget/nuget/Microsfot.VCRTForwarders.140
but not were not copied totarget/debug
. I manually copied them to move forward.STATUS_ACCESS_VIOLATION
when I try to create a WinUI control, NumberBox in this case (see an example here).I could not create a concise example to share since all of the Xaml Islands setup needs to be done before I encountered the issue in step 3. I have pushed a full repo to show the issue: https://github.com/joekgh/win_ui
Some other notes:
cargo winrt
generates for a missing dll is the same as the error for a missing NuGet packagecargo winrt
does not generate any output while it is running. It is hard to know what happened (especially if something goes wrong). Visual Studio NuGet Package Manager outputs quite a bit of status:Special thanks to @roblabla and their ubuntu-installer which I copied ideas from liberally.
Thanks in advance.
The text was updated successfully, but these errors were encountered: