-
Notifications
You must be signed in to change notification settings - Fork 686
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
XamlControlsResources causes crash when used from plain win32 desktop app #7606
Comments
Did you actually try this out in an application that uses the WinUI templates? I ask, because the way you have attempted to add the resources causes it to throw a catastrophic failure even in an unpackaged WinUI3 application. |
Well I tried placing that code into the Yeah, using it in a WinUI template works fine. |
@AzAgarampur Instantiating |
@AzAgarampur Getting it working from there doesn't actually require too much extra work. @riverar is correct in saying that the application requires an IXamlMetadataProvider implementation. But the fact is, as the name implies, it only needs to provide the metadata. |
While this is true, in my experience you won't get far with a more complete implementation of |
@DarranRowe thanks for providing that test app, this is very helpful since I'm trying to get a WinUI 3 app building without Visual Studio. But when I run your solution, on app launch I get error:
Here's the full output: https://gist.github.com/lyahdav/00db0cdcaae9eb2602b2a4a45f79677e Any idea what's going on? |
Oh wait, I think that's due to WinAppSDK 1.1.4 bug: microsoft/WindowsAppSDK#2918. I'll try to downgrade and report back. |
Yeah that was it. I downgraded the WindowsAppSDK version to 1.0.4 and I also had to install the 1.0.4 runtime from here: https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads#windows-app-sdk-10. Then the app launched. |
I would like to share a step by step guide to create a WinUI 3 app from an empty win32 project. This issue helped me to apply the Winui3 theme. Thank you all. |
@sotanakamura You won't get far that way. You will need to include the WinUI 3 nuget to bring in required SxS manifests, the xaml compiler, etc. |
@riverar Thank you for your reply. In that guide I wrote about installing WinUI 3 and the C++/WinRT nuget packages. Is it still having problems? I am not a Windows app developer, I am just playing with WinUI 3. That guide is not for product development. If that guide still has problems, please let me know. |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
I have similar issue: microsoft/WindowsAppSDK-Samples#328 |
Describe the bug
When trying to use WinUI 3 with a plain win32 app from scratch (unpackaged & no winui project template), instantiating
XamlControlsResources
to place into yourApplication
's resources causes a crash.Steps to reproduce the bug
App
classExpected behavior
Creating
XamlControlsResources
won't cause an exception and crash the app; this program should work just like every other unpackaged win32 desktop app using WinUI 3.Screenshots
No response
NuGet package version
1.1.2
Packaging type
Unpackaged
Windows version
Windows 11 version 21H2 (22000)
IDE
Visual Studio 2022
Additional context
Zip file with VS solution:
Test.zip
The text was updated successfully, but these errors were encountered: