-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
I download visual studio 2022 17.4.1 and was surprised to see that "unknown error" is returned from std::error_code using std::system_categoey() as the error category while it was reporting the correct error message before.
After searching on the internet, I found someone complaining about the same issue here : "unknown error" from std::error_code on Windows
The solution was to set the system locale to en-US from "administrative language settings".
I tested it on two windows installations:
Windows 11 with locale set to "en-GB" and worked well when changed to "en-US"
Windows 10 with locale set to "ar-EG" and worked well when changed to "en-US"
I have also visual studio 2019 installed and the binary produced by it works as expected without needing to change the system locale
The issue seems to have appeared in __std_system_error_allocate_message in syserror_import_lib.cpp after this commit <system_error>: explicitly pass the system locale ID for system_categ…
To mention also: both windows installs have "English (United States)" as the "Windows display language" but had system locale different from "en-US"
EDIT: I set both display language and system locale to "ar-EG" but still "unknown error" is returned. Only when system locale is set to en-US the correct message is returned disregarding the display language
Also tracked by internal VSO-1735227 / AB#1735227 .