ResultException::what behaves incorrectly
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3k
- Forks
- 300
- Avg merge
- 19h 12m
- Merged PRs (30d)
- 1
Description
It appears that it returns an empty string, at least in my particular case, on non-English Windows 10 system (Visual Studio Build Tools 2019).
The GetFailureLogString part actually works fine:
I can get the full report from the created string, starting with the drive letter, e. g. "G:\\Test...".
The odd things start with this conversion from wchar_t to char array:
In this newly created messageA string Instead of the drive letter I get the null terminating character, the rest of it appears to be fine, e. g. its contents are - "(null terminating character here):\\Test...". Because this string starts with the null terminating character now, the subsequent call of strlen(messageA) returns zero, and nothing valuable is written to the buffer:
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 include/wil/result_macros.h at the GetFailureLogString and ResultException::what code around lines 2639-2648, focusing on the wchar_t-to-char conversion and subsequent strlen call. Reproduce the behavior on a non-English Windows system or inspect the existing conversion path; done means what() preserves the full failure message instead of returning an empty string.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100