Skip to content

An exception is thrown when CurrentCulture is Turkish (tr-TR) #1096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Engine/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ private void parseSettingsHashtable(Hashtable settingsHashtable)
var settings = GetDictionaryFromHashtable(settingsHashtable);
foreach (var settingKey in settings.Keys)
{
var key = settingKey.ToLower();
var key = settingKey.ToLowerInvariant();
object val = settings[key];
switch (key)
{
Expand Down
20 changes: 20 additions & 0 deletions Tests/Engine/SettingsTest/Issue1095/Issue1095.tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Describe "Issue 1095: An exception is thrown when CurrentCulture is Turkish (tr-TR)" {
It "Should not throw an exception when CurrentCulture is tr-TR" {
# https://github.com/PowerShell/PSScriptAnalyzer/issues/1095

$initialCulture = Get-Culture
$initialUICulture = Get-UICulture

{
$trTRculture = [System.Globalization.CultureInfo]::GetCultureInfo('tr-TR')
[System.Threading.Thread]::CurrentThread.CurrentUICulture = $trTRculture
[System.Threading.Thread]::CurrentThread.CurrentCulture = $trTRculture
Invoke-Formatter "`$test" -ErrorAction Stop

} | Should -Throw -Not

[System.Threading.Thread]::CurrentThread.CurrentCulture = $initialCulture
[System.Threading.Thread]::CurrentThread.CurrentUICulture = $initialUICulture

}
}