`cppwinrt.h`: Improve conversion of error information
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3k
- Forks
- 300
- Avg merge
- 19h 12m
- Merged PRs (30d)
- 1
Description
When using WIL with C++/WinRT with the cppwinrt.h header, the winrt_to_hresult_handler global handler is hooked from WIL directly into the C++/WinRT codebase.
The handler allows WIL exceptions to be understood by C++/WinRT and their HRESULTs extracted, but messages are lost in the way when going over the API boundaries because only the HRESULT is converted in winrt::to_hresult().
C++/WinRT makes use of Get and SetErrorInfo() to recover the messages when re-creating the exceptions on the caller side. The set is done inside winrt::hresult_error::to_abi() in winrt::to_hresult() on the server side, but only when winrt_to_hresult_handler is not hooked. The retrieval happens when re-creating the winrt::hresult_error on the caller.
If WIL were to call the to_abi() method in the WIL hook for winrt_to_hresult_handler, it would properly trigger the storage of the message and later on it could be retrieved when C++/WinRT creates a new winrt::hresult_error on the caller side.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the cppwinrt.h WIL hook and compare its handling with winrt::to_hresult() and hresult_error::to_abi(), as described in the issue. Verify that the WIL exception message is stored through the API boundary and can be recovered when C++/WinRT recreates the error on the caller side.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100