如何从 c++/cx uwp 项目调用 windows 运行时组件?
How to call windows runtime component from c++/cx uwp project?
我在与我的 C++/CX UWP 项目相同的解决方案中基于 Visual Studio 模板创建了一个 C# 运行时组件:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace httpServer
{
public sealed class Class1
{
public int SampleProperty { get; set; }
}
}
我将对组件的引用添加到我的 C++/CX UWP 项目并创建对象如下:
auto srv = ref new httpServer::Class1();
解决方案编译,但在这一行我得到一个异常:
Exception thrown at 0x776A3DB2 in Bonsai Master UWP.exe: Microsoft C++
exception: EEFileLoadException at memory location 0x05598104.
onecore\com\combase\objact\dllcache.cxx(4713)\combase.dll!75CF6DE2:
(caller: 75CFE2BB) ReturnHr(1) tid(8408) 80131040 Exception thrown at
0x776A3DB2 (KernelBase.dll) in Bonsai Master UWP.exe: WinRT originate
error - 0x80131040 : 'The text associated with this error code could
not be found.'.
它看起来像是 Visual Studio 中的错误:
https://social.msdn.microsoft.com/Forums/windowsapps/en-US/6d0d04e8-1471-4343-a78e-65c6405080cc/winrt-component-works-in-c-but-not-in-c?forum=wpdevelop
我检查了 VS 2017 和 VS 2019:两者都出现错误。
我在与我的 C++/CX UWP 项目相同的解决方案中基于 Visual Studio 模板创建了一个 C# 运行时组件:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace httpServer
{
public sealed class Class1
{
public int SampleProperty { get; set; }
}
}
我将对组件的引用添加到我的 C++/CX UWP 项目并创建对象如下:
auto srv = ref new httpServer::Class1();
解决方案编译,但在这一行我得到一个异常:
Exception thrown at 0x776A3DB2 in Bonsai Master UWP.exe: Microsoft C++ exception: EEFileLoadException at memory location 0x05598104.
onecore\com\combase\objact\dllcache.cxx(4713)\combase.dll!75CF6DE2: (caller: 75CFE2BB) ReturnHr(1) tid(8408) 80131040 Exception thrown at 0x776A3DB2 (KernelBase.dll) in Bonsai Master UWP.exe: WinRT originate error - 0x80131040 : 'The text associated with this error code could not be found.'.
它看起来像是 Visual Studio 中的错误: https://social.msdn.microsoft.com/Forums/windowsapps/en-US/6d0d04e8-1471-4343-a78e-65c6405080cc/winrt-component-works-in-c-but-not-in-c?forum=wpdevelop
我检查了 VS 2017 和 VS 2019:两者都出现错误。