coreclr keep TPA lists at hashmap(SimpleNameToFileNameMap) in the applicationcontext.
To add TPA to hashmap, hash code is generated by hash() function with simple name of dll.
In that hash function, towupper() function is used.
The return value of towupper() can be changed by locale setting.
Also, when lookup in hashmap, towlower() function is called for comparing values,
and the return value of this function also changed according to locale.
To prevent key mismatch issue by locale change, set to the locale before coreclr_initialize().
// As a result, CultureInfo is incorrectly generated and malfunctions.
// For example, uloc_getDefault() returns en_US_POSIX, CultureInfo is set to invariant mode.
setenv("LANG", const_cast<char *>(lang), 1);
- setenv("LC_MESSAGES", const_cast<char *>(lang), 1);
- setenv("LC_ALL", const_cast<char *>(lang), 1);
+ setlocale(LC_ALL, const_cast<char *>(lang));
free(lang);
}