Is there any example or way I can consume a CsWinRT library from a CS app? #1427
Replies: 2 comments 4 replies
-
It sounds like you are trying to activate a CsWinRT authored .NET 6+ WinRT component in a UWP app. I assume the UWP app is .NET native. If so, since you are trying to load the .NET 6 runtime within a .NET native app with its own older version of .NET, that is probably going to run into issues and won't work. Given C++ UWP has no .NET version loaded already, it doesn't run into any errors. |
Beta Was this translation helpful? Give feedback.
-
Speaking of Xbox, maybe try moving the whole app to .NET 8? https://github.com/driver1998/NetCoreApp The XAML stuff is hacked together (see #1421 for official support), but other stuff works out of the box. |
Beta Was this translation helpful? Give feedback.
-
I have a C++ UWP app example I setup that consumes a .net6+ C# library using CsWinRT. I then setup a UWP C# app to consume the .net6+ C# library using CsWinRT and it fails when I try to access the same class with an error:
Exception thrown: 'System.Runtime.InteropServices.COMException' in BlankAppCSharp1.exe
An exception of type 'System.Runtime.InteropServices.COMException' occurred in BlankAppCSharp1.exe but was not handled in user code
Error in the DLL (Exception from HRESULT: 0x800401F9 (CO_E_ERRORINDLL))
So I guess my questions are, what might be wrong? Are there any examples around that show how to use a C# UWP referencing a CsWinRT winmd or is that not possible? The C++ UWP app works just fine...
Thanks much!
Beta Was this translation helpful? Give feedback.
All reactions