-
Notifications
You must be signed in to change notification settings - Fork 388
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
An exception is thrown when CurrentCulture is Turkish (tr-TR) #1095
Comments
Thanks for the report and detailed analysis. We'd be happy to accept a PR with a fix for this. I think using the overload with InvariantCulture might fix this. |
I've offered InvariantCulture in a very similar problem in Roslyn. The team didn't accept InvariantCulture because it has bugs that will never be fixed. (the discussion is here) In this case, It won't cause so much trouble. But, I think, "en-US" culture is more suitable. I'll open a PR and offer that solution. |
@alatas "IncludeRules".ToLower([cultureinfo]::CreateSpecificCulture("tr-TR")).equals("includerules") # returns false
"IncludeRules".ToLowerInvariant().equals("includerules") # returns true |
@bergmeister I've just opened a PR including this fix and a test |
@alatas Thanks. I saw it but your approach seems to break other cases. Don't worry I will take it from there. I submitted an alternative PR using |
@alatas Thanks for your efforts. My PR above passes CI, we will take that one instead then. Thanks for the detailed report and initiative from your side! |
@bergmeister thank you, I saw that the CI problems related with my test code. I used Set-Culture command which is not available other than windows. I think that causes the problem. I appreciate that the problem is solved, thanks for your effort |
…ntName This should've been there all along, but was overlooked due to programmer error. The reason it should be there is documented in the comment on the initialization of settingName, which refers to issue PowerShell#1095.
I got an exception when trying to use Invoke-Formatter command. And also, VSCode extension couldn't format the ps1 files, or couldn't analyze the files. When I called the formatter command from the console an exception is thrown that "
The given key 'ıncluderules' was not present in the dictionary.
"I searched the source code and found that the exception is related to this line:
PSScriptAnalyzer/Engine/Settings.cs
Line 398 in 1f855ac
There is a problem with the ToLower function in .net when the CurrentCulture is Turkish (tr-TR). Turkish charset is an alternate version of latin-1 charset. Turkish alphabet has
ı
andi
characters which are different from each other and has different uppercase forms.I
is the uppercase form ofı
, andİ
is the uppercase form ofi
. Therefore, ToLower function has an unexpected behaviour different than the latin-1 charset. When the CurrentCulture is (tr-TR),Include
becomesınclude
(notinclude
) which causes this exception.Steps to reproduce
Expected behavior
$test
Actual behavior
PS 6.1
PS 5.1
Environment data
The text was updated successfully, but these errors were encountered: