试图关闭DesktopWindowXamlSource时引发异常

时间:2020-01-11 07:13:39

标签: c++ xaml winapi uwp xaml-islands

我正在为Win32 C ++ App使用UWP Xaml托管API。我有以下代码:

        winrt::Windows::UI::Xaml::Hosting::WindowsXamlManager XamlManager = winrt::Windows::UI::Xaml::Hosting::
        WindowsXamlManager::InitializeForCurrentThread();
        winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource XamlSource;

完成UWP内容后,我会打电话给

    XamlSource.Close();
    XamlManager.Close();

但是调试器的输出窗口指示正在抛出异常: windows\advcore\winrt\iwindow\corewindow\desktop\desktopwindowcontentbridge.cpp(499)\Windows.UI.dll!00007FFD91CD860F: (caller: 00007FFD91CD7704) ReturnHr(1) tid(7168) 8007139F The group or resource is not in the correct state to perform the requested operation.

我在做什么错了?

1 个答案:

答案 0 :(得分:0)

您是否显示了您的申请?

payload={"eventType": "check", "status": "Fail","testCategory": "Test"}
headers = {‘Content-Type’: ‘application/json’,‘X-Insert-Key’: ‘XXXXXXX’, ‘Content-Encoding’:‘gzip’}
request_body = zlib.compress(json.dumps(payload))
r = requests.post(url, data=request_body, headers=headers)

来自my article