Code Monkey home page Code Monkey logo

Comments (5)

jonwis avatar jonwis commented on September 28, 2024 1

RoOriginateErrorInformation's documentation doesn't seem to say that it resets the error info. The implementation respects RO_ERROR_REPORTING_SUPPRESSSETERRORINFO and RO_ERROR_REPORTING_USESETERRORINFO flags to RoSetErrorReportingFlags ... the logic for when RoOriginate... calls SetErrorInfo appears to be like this:

if (FlagNotSet(RoErrorFlags, RO_ERROR_REPORTING_SUPPRESSSETERRORINFO))
{
    if (FlagSet(RoErrorFlags, RO_ERROR_REPORTING_USESETERRORINFO) || IsDebuggerPresent())
    {
        SetErrorInfo(...);
    }
}

There's other paths through RoOriginateLanguageException that would cause the call to SetErrorInfo to be skipped. I'm inclined to fix up this path against "could not get the extended error info" as that's not really a developer problem as much as an environmental problem.

@ChrisGuzak can you grab a time-travel trace of the test you've got so we can see what's happening?

from cppwinrt.

kennykerr avatar kennykerr commented on September 28, 2024 1

Adding @manodasanW as I think he originally owned/wrote the origination APIs.

from cppwinrt.

jonwis avatar jonwis commented on September 28, 2024

Looks like the hresult_error case handles this properly:

WINRT_IMPL_GetErrorInfo(0, info.put_void());
if ((m_info = info.try_as<impl::IRestrictedErrorInfo>()))
{
WINRT_VERIFY_(0, m_info->GetReference(m_debug_reference.put()));

While the originate path does not:

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

And worse, the originate path is triggered in the "the current info does not implement IRestrictedErrorInfo" case of the hresult_error ctor.

I'd expect that this is a bad assumption on C++/WinRT's part - there's certainly runtimes that will SetErrorInfo(pCustomErrorInfo) that does not implement IRestrictedErrorInfo so we should harden the code with that in mind.

from cppwinrt.

kennykerr avatar kennykerr commented on September 28, 2024

The latter is preceded by a call to RoOriginateLanguageException so that assertion should always hold.

from cppwinrt.

github-actions avatar github-actions commented on September 28, 2024

This issue is stale because it has been open 10 days with no activity. Remove stale label or comment or this will be closed in 5 days.

from cppwinrt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.