How to replicate (we will use Windows Terminal as example):
Clone the Windows Terminal repo and fetch submodules
Create a C# Windows Runtime Component in the solution with a
UserControl
with some random controlsReference the C# WinRT Component from the project you want to host the
UserControl
inOpen an Xaml page in one of Windows Terminal projects (we will use
TerminalPage.xaml
fromTerminalAppLib
project as an example)Add the
UserControl
to that pageCompile and run (you might need to include the generated Xaml compiled files of the
UserControl
topch.h
file for it to compile without Xaml Compiler errors)You will find that the app will crash with
class not registered
exception
What I have tried:
Using
Class Library
instead ofWinRT Component
https://github.com/asklar/WinRTComponent/blob/master/README.md
Registering the class in
WindowsTerminal.manifest
file, like this (I used.dll
instead of.winmd
when I tried withClass Library
):
<file name="myWinRTComponent.winmd" hashalg="SHA1" xmlns:winrt="urn:schemas-microsoft-com:winrt.v1">
<winrt:activatableClass name="Namespace.UserControlClass" threadingModel="both" />
</file>
- Registering the class manually in
AppxManifest.xml
file