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

Bug: version 2.0.240111.5 does not work correctly with XAML #1397

Closed
YexuanXiao opened this issue Mar 13, 2024 · 10 comments · Fixed by #1404
Closed

Bug: version 2.0.240111.5 does not work correctly with XAML #1397

YexuanXiao opened this issue Mar 13, 2024 · 10 comments · Fixed by #1404

Comments

@YexuanXiao
Copy link

Version

2.0.240111.5

Summary

After I upgraded the C++/WinRT version, my WinUI3 project failed to build. After switching to the previous version, it built normally.

1>D:\Projects\PlayerWinRT\src\Player.vcxproj : XamlCompiler error WMC1006: Cannot resolve Assembly or Windows Metadata file 'Type universe cannot resolve assembly: Data, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime.'
1>XamlMetaDataProvider.cpp

WindowsAppSDK v1.5.240311000
SDK.BuildTools v10.0.26031-preview

Reproducible example

No response

Expected behavior

No response

Actual behavior

No response

Additional comments

No response

@sylveon
Copy link
Contributor

sylveon commented Mar 13, 2024

Try cleaning the project before building after upgrading cppwinrt

@YexuanXiao
Copy link
Author

YexuanXiao commented Mar 14, 2024

Try cleaning the project before building after upgrading cppwinrt

I manually cleaned up all the generated files, but I still get the same error, with some linking errors. After I switched back to version 2.0.230706.1, the error disappeared and it built successfully.

1>About.xaml.obj : error LNK2019: unresolved external symbol "public: void __cdecl winrt::Player::implementation::AboutT<struct winrt::Player::implementation::About>::InitializeComponent(void)" (?InitializeComponent@?$AboutT@UAbout@implementation@Player@winrt@@$$V@implementation@Player@winrt@@QEAAXXZ) referenced in function "struct winrt::Player::implementation::About * __cdecl winrt::impl::create_and_initialize<struct winrt::Player::implementation::About>(void)" (??$create_and_initialize@UAbout@implementation@Player@winrt@@$$V@impl@winrt@@YAPEAUAbout@implementation@Player@1@XZ)
1>About.xaml.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl winrt::Player::implementation::AboutT<struct winrt::Player::implementation::About>::Connect(int,struct winrt::Windows::Foundation::IInspectable const &)" (?Connect@?$AboutT@UAbout@implementation@Player@winrt@@$$V@implementation@Player@winrt@@UEAAXHAEBUIInspectable@Foundation@Windows@4@@Z)
1>About.xaml.obj : error LNK2001: unresolved external symbol "public: virtual struct winrt::Microsoft::UI::Xaml::Markup::IComponentConnector __cdecl winrt::Player::implementation::AboutT<struct winrt::Player::implementation::About>::GetBindingConnector(int,struct winrt::Windows::Foundation::IInspectable const &)" (?GetBindingConnector@?$AboutT@UAbout@implementation@Player@winrt@@$$V@implementation@Player@winrt@@UEAA?AUIComponentConnector@Markup@Xaml@UI@Microsoft@4@HAEBUIInspectable@Foundation@Windows@4@@Z)
1>Equalizer.xaml.obj : error LNK2019: unresolved external symbol "public: void __cdecl winrt::Player::implementation::EqualizerT<struct winrt::Player::implementation::Equalizer>::InitializeComponent(void)" (?InitializeComponent@?$EqualizerT@UEqualizer@implementation@Player@winrt@@$$V@implementation@Player@winrt@@QEAAXXZ) referenced in function "struct winrt::Player::implementation::Equalizer * __cdecl winrt::impl::create_and_initialize<struct winrt::Player::implementation::Equalizer>(void)" (??$create_and_initialize@UEqualizer@implementation@Player@winrt@@$$V@impl@winrt@@YAPEAUEqualizer@implementation@Player@1@XZ)
1>Equalizer.xaml.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl winrt::Player::implementation::EqualizerT<struct winrt::Player::implementation::Equalizer>::Connect(int,struct winrt::Windows::Foundation::IInspectable const &)" (?Connect@?$EqualizerT@UEqualizer@implementation@Player@winrt@@$$V@implementation@Player@winrt@@UEAAXHAEBUIInspectable@Foundation@Windows@4@@Z)
1>Equalizer.xaml.obj : error LNK2001: unresolved external symbol "public: virtual struct winrt::Microsoft::UI::Xaml::Markup::IComponentConnector __cdecl winrt::Player::implementation::EqualizerT<struct winrt::Player::implementation::Equalizer>::GetBindingConnector(int,struct winrt::Windows::Foundation::IInspectable const &)" (?GetBindingConnector@?$EqualizerT@UEqualizer@implementation@Player@winrt@@$$V@implementation@Player@winrt@@UEAA?AUIComponentConnector@Markup@Xaml@UI@Microsoft@4@HAEBUIInspectable@Foundation@Windows@4@@Z)
1>InfoListItem.xaml.obj : error LNK2019: unresolved external symbol "public:
...

The full MIDL options displayed in VS is

/iid "nul" /env x64 /h "nul" /W1 /I"D:\Projects\PlayerWinRT\src\Controls" /I"D:\Projects\PlayerWinRT\src\ViewModels" /I"D:\Projects\PlayerWinRT\src\Pages" /I"D:\Projects\PlayerWinRT\src\Data" /I"D:\Projects\PlayerWinRT\src\" /char signed /enum_class /tlb "x64\Debug\Player.tlb" /ns_prefix /metadata_dir "C:\Program Files (x86)\Windows Kits\10\References\10.0.22621.0\windows.foundation.foundationcontract\4.0.0.0" /client none /target "NT60" /notlb /nologo /winrt /dlldata "nul" /server none /proxy "nul" /winmd "x64\Debug\Unmerged\%(Filename).winmd

Looks like the custom idl include directories was lost in one of the generation steps.

@YexuanXiao
Copy link
Author

I found out that #1381 is causing my project to break.

Is this result intentional? @Scottj1s

@kennykerr
Copy link
Collaborator

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

@YexuanXiao
Copy link
Author

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

I’ve found it’s due to a change in the nuget/Microsoft.Windows.CppWinRT.targets file from #1381, so it’s unrelated to the XAML repository.

@kennykerr
Copy link
Collaborator

kennykerr commented Mar 21, 2024

Yes, but that largely serves to support Xaml and the change was made by the same team. I'd love to help but that's your best bet at getting the issue in front of the appropriate developers (they don't monitor this repo).

@Scottj1s
Copy link
Member

@YexuanXiao I'd be glad to take a look at a repro project, if you have one

@YexuanXiao
Copy link
Author

@YexuanXiao I'd be glad to take a look at a repro project, if you have one

I have a repository that replicates the problem: https://github.com/yexuanXiao/PlayerWinRT

@Scottj1s
Copy link
Member

Scottj1s commented Apr 4, 2024

@YexuanXiao thank you for the repro. A fix has been made to CppWinRT: #1404

@Scottj1s
Copy link
Member

Scottj1s commented Apr 5, 2024

Fix has been published: https://www.nuget.org/packages/Microsoft.Windows.CppWinRT/2.0.240405.15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants