Running C++/WinRT quick-start but cause exception in VS2022

Viewed 65

the Following is quick-start program of WinRT:


// WinRT.cpp    
// Single source file runs

#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.Web.Syndication.h>
#include <iostream>
#pragma comment(lib, "windowsapp.lib")

using namespace winrt;
using namespace Windows::Foundation;
using namespace Windows::Web::Syndication;

int main()
{
    winrt::init_apartment();

    Uri rssFeedUri{ L"https://blogs.windows.com/feed" };
    SyndicationClient syndicationClient;
    SyndicationFeed syndicationFeed = syndicationClient.RetrieveFeedAsync(rssFeedUri).get();
    for (const SyndicationItem syndicationItem : syndicationFeed.Items())
    {
        winrt::hstring titleAsHstring = syndicationItem.Title().Text();
        std::wcout << titleAsHstring.c_str() << std::endl;
    }
}

I've configured my compiler platform in Microsoft's tutorial, But Run failed and just throw an Exception:

Platform: Release X64

standard: ISO C++17

Comfomance mode: No

Running but doesn't work !

Exit code

Exception

Exception thrown at 0x00007FFD9C78A839 in WinRT.exe: Microsoft C++ exception: winrt::hresult_error at memory location 0x000000F009CFFA00.

What went wrong? Thanks in advance.

1 Answers

Founded solution. Ouput display security channel supports errors.

solution: Open TLS 1.0, 1.1, 1.2

Related