Unpackaged C++-applications can't activate C#-runtime components
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the CustomControls sample and the CppAppUnpackaged startup project, reproducing the failure during Application::Start. Inspect the activation path for WinUIComponentCs.WinUIComponentCs_XamlTypeInfo.XamlMetaDataProvider, including base.h and factory_cache_entry, and compare the behavior with the working x86 build. Done means the unpackaged C++ sample can activate the C# runtime component without the reported exception.
Written by the indexing model from the issue text.
Description
Steps to reproduce:
- Clone the repository
- Open the "CustomControls" sample solution
- Select CppAppUnpackaged as startup project
- Run
- The app halts with an unhandled exception during Application::Start
The error message in the UnhandledException-handler is "Cannot create instance of type 'Microsoft.UI.Xaml.Controls.XamlControlsResources' [Line: 17 Position: 37]"
Setting a breakpoint in base.h, factory_cache_entry, I think that this is related to the activation of "WinUIComponentCs.WinUIComponentCs_XamlTypeInfo.XamlMetaDataProvider".
Apparently, it's not possible currently to activate C#-components in an unpackaged Cpp-application; at least not according to the current documentation and provided samples.
Environment: Visual Studio Community 2022 17.9.4.
This happens with the NuGet packages in the versions referenced in the sample project, but also with up-to-date packages.
Update: the x86 build works as expected.
- Dominant language
- PowerShell
- Stars
- 1k
- Forks
- 335
- Avg merge
- 5d 1h
- Merged PRs (30d)
- 8
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/WindowsAppSDK-Samples
-
"Samples\Content\cpp-win32\Squares\Squares.vcxproj" doesn't configure precompiled headers correctly Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
microsoft/WindowsAppSDK-Samples#595 · 1 assignee ·
-
Difficulty 4/5 3-5 days Newbie friendliness 28/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
microsoft/WindowsAppSDK-Samples#580 · 1 comment ·
All issues in microsoft/WindowsAppSDK-Samples
Similar issues
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
objective-see/LuLu#925 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
farion1231/cc-switch#7638 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
PolyMeilex/rfd#334 ·