Skip to content
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

Open
ghost opened this issue May 2, 2024 · 8 comments
Labels
area-ProjectSystem bug Something isn't working team-Markup Issue for the Markup team

Comments

@ghost
Copy link

ghost commented May 2, 2024

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 type Microsoft.UI.Xaml.Controls.XamlControlsResources'.

When loading the DataGrid in the code-behind, a System.TypeInitializationException occurs, with the internal exception being a NullReferenceException: '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?

@ghost ghost added the bug Something isn't working label May 2, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label May 2, 2024
Copy link

github-actions bot commented May 2, 2024

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:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@codendone codendone added team-Markup Issue for the Markup team and removed needs-triage Issue needs to be triaged by the area owners labels May 3, 2024
@codendone
Copy link
Contributor

Can you attach a repro project?

@JesseCol JesseCol added the needs-author-feedback Asked author to supply more information. label May 3, 2024
@ghost
Copy link
Author

ghost commented May 8, 2024

DataGrid.zip

I have attached the sample

@microsoft-github-policy-service microsoft-github-policy-service bot added needs-triage Issue needs to be triaged by the area owners and removed needs-author-feedback Asked author to supply more information. labels May 8, 2024
@ghost
Copy link
Author

ghost commented May 14, 2024

Any update on this?

@codendone codendone added area-ProjectSystem and removed needs-triage Issue needs to be triaged by the area owners labels May 23, 2024
@Santhoshsf3897
Copy link

Any update on this?

3 similar comments
@Santhoshsf3897
Copy link

Any update on this?

@Santhoshsf3897
Copy link

Any update on this?

@Santhoshsf3897
Copy link

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-ProjectSystem bug Something isn't working team-Markup Issue for the Markup team
Projects
None yet
Development

No branches or pull requests

3 participants