Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Bug: winrt::hresult_error::originate asserts when using a clr.dll based error info object #1380

Copy link
Copy link
@ChrisGuzak

Description

@ChrisGuzak
Issue body actions

Version

C++/WinRT v2.0.220418.1

Summary

In winrt::hresult_error::originate, running in the context of a Microsoft::VisualStudio::CppUnitTestFramework project, where the error info object is provided by clr.dll and it does not implement IRestrictedErrorInfo. the WINRT_VERIFY(info.try_as(m_info)) line fails the assert.

base.h, ~4892

            com_ptr<impl::IErrorInfo> info;
            WINRT_VERIFY_(0, WINRT_IMPL_GetErrorInfo(0, info.put_void()));
            WINRT_VERIFY(info.try_as(m_info));

Is this a bug in the CLR or is the design intended to support this?

Reproducible example

TEST_METHOD(CatchCppWinRtException)
{
    try
    {
        winrt::check_hresult(E_NOT_SET);
    }
    catch (...)
    {
    }
}

Expected behavior

no assert, but I'm not sure if this is bug in the CLR or cppwinrt

Actual behavior

assert, in debug build

Additional comments

No response

Reactions are currently unavailable

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.