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

C++/WinRT - InitializeComponent issue with XAML derived class in sub-namespace #7600

Closed
1 of 2 tasks
JaiganeshKumaran opened this issue Aug 13, 2022 · 4 comments
Closed
1 of 2 tasks
Labels
bug Something isn't working needs-author-feedback Asked author to supply more information. no-recent-activity team-Markup Issue for the Markup team

Comments

@JaiganeshKumaran
Copy link
Contributor

Describe the bug

Original issue: microsoft/cppwinrt#1169.
Minimal repro: https://github.com/Jaiganeshkumaran/XamlIssueRepro.Cpp.

Having a XAML class deriving from another control like Button, rather than Page/UserControl, fails to compile, saying InitializeComponent is not a member. I've noticed that this only occurs when the type is inside a sub-namespace, that is sub-namespace of the project's root namespace.

Steps to reproduce the bug

  1. Create a new XAML control in a sub-namespace.
  2. Build the project.
  3. See errors show up.

Expected behavior

No response

Screenshots

No response

NuGet package version

No response

Windows app type

  • UWP
  • Win32

Device form factor

No response

Windows version

Windows 11 (21H2): Build 22000

Additional context

1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(25,39): error C2039: 'InitializeComponent': is not a member of 'winrt::OneToolkit::UI::Xaml::Controls::implementation::DescriptiveButton_base<D,I...>' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(26,1): error C2447: '{': missing function header (old-style formal list?) (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(36,39): warning C4346: 'winrt::OneToolkit::UI::Xaml::Controls::implementation::DescriptiveButton_base<D,I...>::Connect': dependent name is not a type (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(36,39): message : prefix with 'typename' to indicate a type (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(36,69): error C2061: syntax error: identifier 'IInspectable' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(36,39): error C2039: 'Connect': is not a member of 'winrt::OneToolkit::UI::Xaml::Controls::implementation::DescriptiveButton_base<D,I...>' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(37,1): error C2447: '{': missing function header (old-style formal list?) (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(57,39): error C2039: 'DisconnectUnloadedObject': is not a member of 'winrt::OneToolkit::UI::Xaml::Controls::implementation::DescriptiveButton_base<D,I...>' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(58,1): error C2447: '{': missing function header (old-style formal list?) (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(63,39): error C2039: 'UnloadObject': is not a member of 'winrt::OneToolkit::UI::Xaml::Controls::implementation::DescriptiveButton_base<D,I...>' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(64,1): error C2447: '{': missing function header (old-style formal list?) (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(69,54): warning C4346: 'winrt::OneToolkit::UI::Xaml::Controls::implementation::DescriptiveButton_base<D,I...>::GetBindingConnector': dependent name is not a type (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(69,54): message : prefix with 'typename' to indicate a type (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(69,96): error C2061: syntax error: identifier 'IInspectable' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(69,54): error C2039: 'GetBindingConnector': is not a member of 'winrt::OneToolkit::UI::Xaml::Controls::implementation::DescriptiveButton_base<D,I...>' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(70,1): error C2447: '{': missing function header (old-style formal list?) (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(89,41): error C2039: 'DescriptiveButton_obj1_Bindings': is not a member of 'winrt::OneToolkit::UI::Xaml::Controls::implementation::DescriptiveButton_base<D,I...>' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(103,44): error C2061: syntax error: identifier 'IInspectable' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(321): message : see reference to class template instantiation 'winrt::OneToolkit::UI::Xaml::Controls::implementation::DescriptiveButton_obj1_Bindings<D,I...>' being compiled (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(242,38): error C2061: syntax error: identifier 'IInspectable' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(246,32): error C2061: syntax error: identifier 'IInspectable' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(250,28): error C2061: syntax error: identifier 'IInspectable' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(254,25): error C2061: syntax error: identifier 'IInspectable' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(109,42): error C3861: 'target': identifier not found (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(115,42): error C3861: 'target': identifier not found (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(121,42): error C3861: 'target': identifier not found (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(127,42): error C3861: 'target': identifier not found (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(323,65): error C3431: 'winrt::OneToolkit::UI::Xaml::Controls::implementation::DescriptiveButtonT = winrt::OneToolkit::UI::Xaml::Controls::implementation::DescriptiveButton_base<D,I...>': alias cannot be redeclared as class (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\Controls.DescriptiveButton.g.h(72,5): message : see declaration of 'winrt::OneToolkit::UI::Xaml::Controls::implementation::DescriptiveButtonT' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\DescriptiveButton.xaml.g.hpp(323,65): error C2059: syntax error: ';' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\PivotView.xaml.g.hpp(25,31): error C2039: 'InitializeComponent': is not a member of 'winrt::OneToolkit::UI::Xaml::Controls::implementation::PivotView_base<D,I...>' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\PivotView.xaml.g.hpp(26,1): error C2447: '{': missing function header (old-style formal list?) (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\PivotView.xaml.g.hpp(36,31): warning C4346: 'winrt::OneToolkit::UI::Xaml::Controls::implementation::PivotView_base<D,I...>::Connect': dependent name is not a type (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\PivotView.xaml.g.hpp(36,31): message : prefix with 'typename' to indicate a type (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\PivotView.xaml.g.hpp(36,48): error C2061: syntax error: identifier 'IInspectable' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\PivotView.xaml.g.hpp(36,31): error C2039: 'Connect': is not a member of 'winrt::OneToolkit::UI::Xaml::Controls::implementation::PivotView_base<D,I...>' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\PivotView.xaml.g.hpp(37,1): error C2447: '{': missing function header (old-style formal list?) (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\PivotView.xaml.g.hpp(42,31): error C2039: 'DisconnectUnloadedObject': is not a member of 'winrt::OneToolkit::UI::Xaml::Controls::implementation::PivotView_base<D,I...>' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\PivotView.xaml.g.hpp(43,1): error C2447: '{': missing function header (old-style formal list?) (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\PivotView.xaml.g.hpp(48,31): error C2039: 'UnloadObject': is not a member of 'winrt::OneToolkit::UI::Xaml::Controls::implementation::PivotView_base<D,I...>' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\PivotView.xaml.g.hpp(49,1): error C2447: '{': missing function header (old-style formal list?) (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\PivotView.xaml.g.hpp(55,46): warning C4346: 'winrt::OneToolkit::UI::Xaml::Controls::implementation::PivotView_base<D,I...>::GetBindingConnector': dependent name is not a type (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\PivotView.xaml.g.hpp(55,46): message : prefix with 'typename' to indicate a type (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\PivotView.xaml.g.hpp(55,75): error C2061: syntax error: identifier 'IInspectable' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\PivotView.xaml.g.hpp(55,46): error C2039: 'GetBindingConnector': is not a member of 'winrt::OneToolkit::UI::Xaml::Controls::implementation::PivotView_base<D,I...>' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\PivotView.xaml.g.hpp(56,1): error C2447: '{': missing function header (old-style formal list?) (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\PivotView.xaml.g.hpp(60,49): error C3431: 'winrt::OneToolkit::UI::Xaml::Controls::implementation::PivotViewT = winrt::OneToolkit::UI::Xaml::Controls::implementation::PivotView_base<D,I...>': alias cannot be redeclared as class (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\Controls.PivotView.g.h(57,5): message : see declaration of 'winrt::OneToolkit::UI::Xaml::Controls::implementation::PivotViewT' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\PivotView.xaml.g.hpp(60,49): error C2059: syntax error: ';' (compiling source file Generated Files\XamlTypeInfo.g.cpp)
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\XamlTypeInfo.g.cpp(1436,65): error C3083: 'XamlTypeInfo': the symbol to the left of a '::' must be a type
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\XamlTypeInfo.g.cpp(1436,79): error C2039: 'XamlControlsXamlMetaDataProvider': is not a member of 'winrt::Microsoft::UI::Xaml'
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\winrt\impl\OneToolkit.UI.Xaml.Controls.0.h(6): message : see declaration of 'winrt::Microsoft::UI::Xaml'
1>C:\Users\jaiga\Desktop\Source\OneToolkit\OneToolkit.UI.Xaml\Uwp\Generated Files\XamlTypeInfo.g.cpp(1436,111): error C3861: 'XamlControlsXamlMetaDataProvider': identifier not found
@JaiganeshKumaran JaiganeshKumaran added the bug Something isn't working label Aug 13, 2022
@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Aug 13, 2022
@bpulliam bpulliam added the team-Markup Issue for the Markup team label Oct 29, 2022
@bpulliam bpulliam removed the needs-triage Issue needs to be triaged by the area owners label Dec 6, 2022
@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 4, 2023
@JaiganeshKumaran
Copy link
Contributor Author

@bpulliam @gabbybilka Please re-open the issue.

@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Dec 13, 2023
@bpulliam bpulliam reopened this Feb 29, 2024
@bpulliam bpulliam removed needs-triage Issue needs to be triaged by the area owners product-winui2 no-issue-activity labels Feb 29, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Feb 29, 2024
@bpulliam bpulliam removed the needs-triage Issue needs to be triaged by the area owners label Feb 29, 2024
@JesseCol
Copy link

JesseCol commented Mar 1, 2024

Hi, does this only repro in UWP? Are you using System Xaml / WinUI2, or are you using WinAppSDK / WinUI3? (looks like the link to your repro app is broken). Thanks!

@JesseCol JesseCol added the needs-author-feedback Asked author to supply more information. label Mar 1, 2024
Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.

@JesseCol JesseCol closed this as not planned Won't fix, can't repro, duplicate, stale Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-author-feedback Asked author to supply more information. no-recent-activity team-Markup Issue for the Markup team
Projects
None yet
Development

No branches or pull requests

4 participants