microsoft / cppwinrt

C++/WinRT
MIT License
1.61k stars 232 forks source link

Bug:Build failure due to namespace changes in XamlTypeInfo after C++/WinRT update #1398

Closed takatsuka2022 closed 3 months ago

takatsuka2022 commented 4 months ago

Version

2.0.240111.5

Summary

I'm experiencing a build failure when referencing a WinUI 3 runtime component (root namespace: Control1) in a WinUI 3 project (root namespace: App1). The namespaces registered in App1's XamlTypeInfo are different before and after updating C++/WinRT.

Before the update, the entry in XamlTypeInfo looks like this:

L"Control1.UserControl1", L"",
&ActivateType<::winrt::Control1::UserControl1>, nullptr, nullptr, nullptr,
121, // Microsoft.UI.Xaml.Controls.UserControl
85, 0, -1, TypeKind::Metadata,
TypeInfo_Flags_None,
-1,

After the update, it changes to:

L"Control1.UserControl1", L"",
&ActivateLocalType<::winrt::Control1::implementation::UserControl1>, nullptr, nullptr, nullptr,
121, // Microsoft.UI.Xaml.Controls.UserControl
85, 0, -1, TypeKind::Custom,
TypeInfo_Flags_IsLocalType | TypeInfo_Flags_None,
-1,

This change seems to be causing the build to fail. Could anyone help me understand how to resolve the build issue?

Reproducible example

No response

Expected behavior

No response

Actual behavior

No response

Additional comments

No response

kennykerr commented 3 months ago

For Xaml issues please use this repo: https://github.com/microsoft/microsoft-ui-xaml

YexuanXiao commented 3 months ago

I found a troubleshooter that may be related to this, at the bottom of the page: https://learn.microsoft.com/en-us/windows/uwp/winrt-components/create-a-windows-runtime-component-in-cppwinrt