-
Notifications
You must be signed in to change notification settings - Fork 693
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
WinUI 3 App - InitializeComponent Fails with WinRT Error and TypeInitializationException #9606
Comments
Hi I'm an AI powered bot that finds similar issues based off the issue title. Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you! Open similar issues:
Closed similar issues:
|
Can you attach a repro project? |
I have attached the sample |
Any update on this? |
Any update on this? |
3 similar comments
Any update on this? |
Any update on this? |
Any update on this? |
Describe the bug
This is a minimal WinUI 3 desktop app written in C++, hosting a WinUI 3 runtime component written in C# to display the Community Toolkit DataGrid.
When attempting to declare the DataGrid in a XAML file, InitializeComponent fails with the WinRT error
0x802B000A
: 'Cannot create instance of typeMicrosoft.UI.Xaml.Controls.XamlControlsResources
'.When loading the DataGrid in the code-behind, a
System.TypeInitializationException
occurs, with the internal exception being aNullReferenceException
: 'Object reference not set to an instance of an object'.Steps to reproduce the bug
However, our host application is written in winrt/c++, which means we have to load the components as external winui3-runtime components.
Expected behavior
WinRT Error and TypeInitializationException should not occur.
Screenshots
No response
NuGet package version
None
Windows version
No response
Additional context
Any suggestions for resolving this issue?
The text was updated successfully, but these errors were encountered: