microsoft / microsoft/microsoft-ui-xaml

After some time c++ winrt project build starts failing

Open
#10,038 8 comments 0 reactions 0 assignees View on GitHub
bug needs-triage
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

### Describe the bug

Blank App, Packaged (WinUI 3 in desktop) C++ project with idl files builds eventually start failing due to not recognizing winrt.

### Steps to reproduce the bug

I can't recreate this consistently. Using Visual Studio 2022 64-bit 17.11.4. Used the "Blank App, Packaged (WinUI 3 in desktop)" template. Changed the following in the project file:
true to false
false

and added these:
None
true

Created a couple idl files for a view model and corresponding .h and .cpp files. Things will be working fine and suddenly, my builds start failing. Even if I only did one thing between the last successful build and the currently failing one and I undo that change, the build continues to fail. As an example, the last time this happened, the only change I made between the last successful build and the currently failing one was changing from C++17 to C++20. Even after undoing that change, the build continued to fail in the same way.

I tried upgrading to the latest nuget packages and tried stopping using pre-compiled headers but it still fails.

This has happened several times now. Each time I started over with a fresh project and eventually it starts failing like this. There doesn't seem to be a clear action. It always seems to follow a different action.

I have another project similar to the ones that fail but that one doesn't have any idl files. So maybe something about the idl files is triggering the failure.

I think this will be hard to recreate. If needed, I can provide a zip of a solution where this is currently happening. I would've attached it to this issue but it's too big.

Removed the successful first part of the build as the full log was too long to include in this issue.

Build log:

Build started at 7:46 PM...
1>------ Build started: Project: TestG, Configuration: Debug x64 ------
...
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.22621.0\windows.ui.xaml.core.direct.xamldirectcontract\5.0.0.0\windows.ui.xaml.core.direct.xamldirectcontract.winmd
1>Microsoft(R) Metadata Merge Utility Version 10.0.49.
1>
1>
1>Processing input metadata file TestG\x64\Debug\Unmerged\MainWindow.winmd.
1>Processing input metadata file TestG\x64\Debug\Unmerged\Process.winmd.
1>Processing input metadata file TestG\x64\Debug\Unmerged\Request.winmd.
1>Processing input metadata file TestG\x64\Debug\Unmerged\XamlMetaDataProvider.winmd.
1>Saved output metadata file TestG.winmd.
1>Validating metadata file TestG\x64\Debug\Merged\TestG.winmd.
1>pch.cpp
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\Microsoft.UI.Xaml.Data.h(7,15): error C2653: 'winrt': is not a class or namespace name
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\Microsoft.UI.Xaml.Data.h(7,22): error C3861: 'check_version': identifier not found
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\Microsoft.UI.Xaml.Data.h(7,35): error C2131: expression did not evaluate to a constant
1>(compiling source file 'pch.cpp')
1> C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\Microsoft.UI.Xaml.Data.h(7,35):
1> a non-constant (sub-)expression was encountered
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\Microsoft.UI.Xaml.h(7,15): error C2653: 'winrt': is not a class or namespace name
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\Microsoft.UI.Xaml.h(7,22): error C3861: 'check_version': identifier not found
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\Microsoft.UI.Xaml.h(7,35): error C2131: expression did not evaluate to a constant
1>(compiling source file 'pch.cpp')
1> C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\Microsoft.UI.Xaml.h(7,35):
1> a non-constant (sub-)expression was encountered
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\Microsoft.UI.h(7,15): error C2653: 'winrt': is not a class or namespace name
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\Microsoft.UI.h(7,22): error C3861: 'check_version': identifier not found
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\Microsoft.UI.h(7,35): error C2131: expression did not evaluate to a constant
1>(compiling source file 'pch.cpp')
1> C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\Microsoft.UI.h(7,35):
1> a non-constant (sub-)expression was encountered
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(6,14): error C2143: syntax error: missing ';' before 'namespace'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(6,1): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(10,14): error C2143: syntax error: missing ';' before 'namespace'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(10,1): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(10,1): error C2086: 'int WINRT_EXPORT': redefinition
1>(compiling source file 'pch.cpp')
1> C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(6,1):
1> see declaration of 'WINRT_EXPORT'
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(19,57): error C2146: syntax error: missing ';' before identifier 'IIterable'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(19,57): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(20,57): error C2146: syntax error: missing ';' before identifier 'IIterator'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(20,57): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(21,69): error C2146: syntax error: missing ';' before identifier 'IKeyValuePair'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(21,14): error C2977: 'winrt::Windows::Foundation::Collections::WINRT_IMPL_EMPTY_BASES': too many template arguments
1>(compiling source file 'pch.cpp')
1> C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(19,34):
1> see declaration of 'winrt::Windows::Foundation::Collections::WINRT_IMPL_EMPTY_BASES'
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(21,69): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(22,57): error C2146: syntax error: missing ';' before identifier 'IMapChangedEventArgs'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(22,57): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(23,69): error C2146: syntax error: missing ';' before identifier 'IMapView'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(23,14): error C2977: 'winrt::Windows::Foundation::Collections::WINRT_IMPL_EMPTY_BASES': too many template arguments
1>(compiling source file 'pch.cpp')
1> C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(19,34):
1> see declaration of 'winrt::Windows::Foundation::Collections::WINRT_IMPL_EMPTY_BASES'
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(23,69): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(24,69): error C2146: syntax error: missing ';' before identifier 'IMap'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(24,14): error C2977: 'winrt::Windows::Foundation::Collections::WINRT_IMPL_EMPTY_BASES': too many template arguments
1>(compiling source file 'pch.cpp')
1> C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(19,34):
1> see declaration of 'winrt::Windows::Foundation::Collections::WINRT_IMPL_EMPTY_BASES'
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(24,69): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(25,69): error C2146: syntax error: missing ';' before identifier 'IObservableMap'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(25,14): error C2977: 'winrt::Windows::Foundation::Collections::WINRT_IMPL_EMPTY_BASES': too many template arguments
1>(compiling source file 'pch.cpp')
1> C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(19,34):
1> see declaration of 'winrt::Windows::Foundation::Collections::WINRT_IMPL_EMPTY_BASES'
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(25,69): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(26,57): error C2146: syntax error: missing ';' before identifier 'IObservableVector'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(26,57): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(29,57): error C2146: syntax error: missing ';' before identifier 'IVectorView'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(29,57): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(30,57): error C2146: syntax error: missing ';' before identifier 'IVector'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(30,57): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(34,69): error C2146: syntax error: missing ';' before identifier 'MapChangedEventHandler'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(34,14): error C2977: 'winrt::Windows::Foundation::Collections::WINRT_IMPL_EMPTY_BASES': too many template arguments
1>(compiling source file 'pch.cpp')
1> C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(19,34):
1> see declaration of 'winrt::Windows::Foundation::Collections::WINRT_IMPL_EMPTY_BASES'
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(34,69): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(35,57): error C2146: syntax error: missing ';' before identifier 'VectorChangedEventHandler'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(35,57): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(39,42): error C3856: 'category': symbol is not a class template
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(39,84): error C2143: syntax error: missing ';' before 'winrt::Windows::Foundation::Collections::IIterable'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(39,93): error C2143: syntax error: missing ';' before '<'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(39,84): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(39,84): error C2086: 'int winrt::Windows::Foundation::Collections::IIterable': redefinition
1>(compiling source file 'pch.cpp')
1> C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(19,57):
1> see declaration of 'winrt::Windows::Foundation::Collections::IIterable'
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(39,97): error C2143: syntax error: missing ';' before '{'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(39,97): error C2447: '{': missing function header (old-style formal list?)
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(40,34): error C2974: 'winrt::impl::category': invalid template argument for 'T', type expected
1>(compiling source file 'pch.cpp')
1> C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(39,34):
1> see declaration of 'winrt::impl::category'
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(40,95): error C2988: unrecognizable template declaration/definition
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(40,95): error C2143: syntax error: missing ';' before '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(40,95): error C2059: syntax error: '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(40,97): error C2143: syntax error: missing ';' before '{'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(40,97): error C2447: '{': missing function header (old-style formal list?)
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(41,46): error C2977: 'winrt::impl::category': too many template arguments
1>(compiling source file 'pch.cpp')
1> C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(39,34):
1> see declaration of 'winrt::impl::category'
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(41,114): error C2988: unrecognizable template declaration/definition
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(41,114): error C2143: syntax error: missing ';' before '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(41,14): error C2977: 'winrt::impl::category': too many template arguments
1>(compiling source file 'pch.cpp')
1> C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(39,34):
1> see declaration of 'winrt::impl::category'
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(41,114): error C2059: syntax error: '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(41,116): error C2143: syntax error: missing ';' before '{'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(41,116): error C2447: '{': missing function header (old-style formal list?)
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(42,106): error C2988: unrecognizable template declaration/definition
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(42,106): error C2143: syntax error: missing ';' before '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(42,106): error C2059: syntax error: '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(42,108): error C2143: syntax error: missing ';' before '{'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(42,108): error C2447: '{': missing function header (old-style formal list?)
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(43,109): error C2988: unrecognizable template declaration/definition
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(43,109): error C2143: syntax error: missing ';' before '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(43,14): error C2977: 'winrt::impl::category': too many template arguments
1>(compiling source file 'pch.cpp')
1> C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(39,34):
1> see declaration of 'winrt::impl::category'
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(43,109): error C2059: syntax error: '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(43,111): error C2143: syntax error: missing ';' before '{'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(43,111): error C2447: '{': missing function header (old-style formal list?)
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(44,105): error C2988: unrecognizable template declaration/definition
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(44,105): error C2143: syntax error: missing ';' before '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(44,14): error C2977: 'winrt::impl::category': too many template arguments
1>(compiling source file 'pch.cpp')
1> C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(39,34):
1> see declaration of 'winrt::impl::category'
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(44,105): error C2059: syntax error: '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(44,107): error C2143: syntax error: missing ';' before '{'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(44,107): error C2447: '{': missing function header (old-style formal list?)
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(45,115): error C2988: unrecognizable template declaration/definition
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(45,115): error C2143: syntax error: missing ';' before '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(45,14): error C2977: 'winrt::impl::category': too many template arguments
1>(compiling source file 'pch.cpp')
1> C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(39,34):
1> see declaration of 'winrt::impl::category'
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(45,115): error C2059: syntax error: '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(45,117): error C2143: syntax error: missing ';' before '{'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(45,117): error C2447: '{': missing function header (old-style formal list?)
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(46,103): error C2988: unrecognizable template declaration/definition
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(46,103): error C2143: syntax error: missing ';' before '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(46,103): error C2059: syntax error: '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(46,105): error C2143: syntax error: missing ';' before '{'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(46,105): error C2447: '{': missing function header (old-style formal list?)
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(47,24): error C2913: explicit specialization; 'winrt::impl::category' is not a specialization of a class template
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(48,24): error C2913: explicit specialization; 'winrt::impl::category' is not a specialization of a class template
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(49,97): error C2988: unrecognizable template declaration/definition
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(49,97): error C2143: syntax error: missing ';' before '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(49,97): error C2059: syntax error: '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(49,99): error C2143: syntax error: missing ';' before '{'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(49,99): error C2447: '{': missing function header (old-style formal list?)
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(50,93): error C2988: unrecognizable template declaration/definition
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(50,93): error C2143: syntax error: missing ';' before '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(50,93): error C2059: syntax error: '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(50,95): error C2143: syntax error: missing ';' before '{'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(50,95): error C2447: '{': missing function header (old-style formal list?)
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(51,24): error C2913: explicit specialization; 'winrt::impl::category' is not a specialization of a class template
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(52,24): error C2913: explicit specialization; 'winrt::impl::category' is not a specialization of a class template
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(53,24): error C2913: explicit specialization; 'winrt::impl::category' is not a specialization of a class template
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(54,24): error C2913: explicit specialization; 'winrt::impl::category' is not a specialization of a class template
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(55,123): error C2988: unrecognizable template declaration/definition
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(55,123): error C2143: syntax error: missing ';' before '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(55,14): error C2977: 'winrt::impl::category': too many template arguments
1>(compiling source file 'pch.cpp')
1> C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(54,24):
1> see declaration of 'winrt::impl::category'
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(55,123): error C2059: syntax error: '>'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(55,125): error C2143: syntax error: missing ';' before '{'
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(55,125): error C2447: '{': missing function header (old-style formal list?)
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(56,111): error C2988: unrecognizable template declaration/definition
1>(compiling source file 'pch.cpp')
1>C:\Users\developer\MyData\VSTEST\TestG\Generated Files\winrt\impl\Windows.Foundation.Collections.0.h(56,111): error C1003: error count exceeds 100; stopping compilation
1>(compiling source file 'pch.cpp')
1>Done building project "TestG.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 7:46 PM and took 06.775 seconds ==========

### Expected behavior

I expect the build to succeed

### Screenshots

_No response_

### NuGet package version

None

### Windows version

_No response_

### Additional context

Actually on Windows 11 Pro 10.0.22631

Contributor guide

Open the contributing guide

Research direction

Start with the Blank App, Packaged (WinUI 3 in desktop) C++ template in Visual Studio 2022 17.11.4, the project-file changes, IDL files, and the failing pch.cpp build shown in the log. Compare a fresh working project with one that fails and inspect the Generated Files\winrt headers. Done means the failure is reproducible or narrowed to a documented trigger and the project builds successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system, desktop
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.