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
UserControlwith some random controlsReference the C# WinRT Component from the project you want to host the
UserControlinOpen an Xaml page in one of Windows Terminal projects (we will use
TerminalPage.xamlfromTerminalAppLibproject as an example)Add the
UserControlto that pageCompile and run (you might need to include the generated Xaml compiled files of the
UserControltopch.hfile for it to compile without Xaml Compiler errors)You will find that the app will crash with
class not registeredexception
What I have tried:
Using
Class Libraryinstead ofWinRT Componenthttps://github.com/asklar/WinRTComponent/blob/master/README.md
Registering the class in
WindowsTerminal.manifestfile, like this (I used.dllinstead of.winmdwhen 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.xmlfile