Skip to content

Empty hresult_error::message() in last C++/WinRT #623

@sbogdano-quest

Description

@sbogdano-quest

The code below has different output on Windows 7 depending on C++/WinRT version that was used for the code compilation due to hresult_error::message() is empty in last C++/WinRT (the code is compiled in latest VS2019):
C++/WinRT 2.0.200115.8: winrt::hresult_error: ClassFactory cannot supply requested class. Code: 0x80040111
C++/WinRT 2.0.200508.4: winrt::hresult_error: . Code: 0x80040111

#include <iostream>
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.Security.Authentication.Web.Core.h>

using namespace std;
using namespace winrt;
using namespace Windows::Foundation;
using namespace Windows::Security::Authentication::Web::Core;

int main(int argc, char* argv[])
{
    try
    {
        auto wap = WebAuthenticationCoreManager::FindAccountProviderAsync(L"https://login.microsoft.com", L"organizations").get();
    }
    catch (const hresult_error& exc)
    {
        wcout << L"winrt::hresult_error: " << exc.message().c_str() << L". Code: 0x" << hex << exc.code() << endl;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions