【问题标题】:How to call windows runtime component from c++/cx uwp project?如何从 c++/cx uwp 项目调用 Windows 运行时组件?
【发布时间】:2020-06-05 06:46:40
【问题描述】:

我在与我的 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();

解决方案编译,但在这一行我得到一个异常:

在盆景大师 UWP.exe 中的 0x776A3DB2 处引发异常:Microsoft C++ 异常:内存位置 0x05598104 处出现 EEFileLoadException。

onecore\com\combase\objact\dllcache.cxx(4713)\combase.dll!75CF6DE2: (调用者:75CFE2BB)ReturnHr(1) tid(8408) 80131040 抛出异常 Bonsai Master UWP.exe 中的 0x776A3DB2 (KernelBase.dll):WinRT 起源 错误 - 0x80131040 : '与此错误代码相关的文本可能 找不到。'。

【问题讨论】:

    标签: c# uwp c++-cx


    【解决方案1】:

    它看起来像 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:两者都出现了错误。

    【讨论】:

      猜你喜欢
      • 2019-07-07
      • 2015-04-25
      • 2020-09-19
      • 2013-01-18
      • 2013-04-01
      • 2019-08-14
      • 2017-09-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多