GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Replace StringComparision.CurrentCulture with StringComparision.Ordinal by iSazonov · Pull Request #8068 · PowerShell/PowerShell

Conversation

@iSazonov

@iSazonov Ilya (iSazonov) commented Oct 18, 2018 •
edited by TravisEz13
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

PR Summary

Related #8064

Replace StringComparision.CurrentCulture with StringComparision.Ordinal.

Best Practices for Using Strings in .NET

Not all code base is fixed. There are not obvious cases.

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Change is not breaking
  • Make sure all .h, .cpp, .cs, .ps1 and .psm1 files have the correct copyright header
  • This PR is ready to merge and is not Work in Progress.
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready.
  • User-facing changes
    • Not Applicable
    • OR
    • User-facing Documentation needed
      • Issue filed - Issue link:
  • Testing - New and feature
    • Not Applicable or can only be tested interactively
    • OR
    • Make sure you've added a new test if existing tests do not effectively test the code changed
      • Add [feature] if the change is significant or affects feature tests

This change is Reviewable

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Ilya (iSazonov) added 25 commits October 18, 2018 18:26
@iSazonov
Import-Counter
9f692c4
@iSazonov
EventLog
88b2694
@iSazonov
GetComputerInfo
2a1cc3c
@iSazonov
Computer
dba2637
@iSazonov
Process
66ff459
@iSazonov
Services
cbeb80f
@iSazonov
ConsoleHost
658d851
@iSazonov
ConsoleHostUserInterface
ac707c9
@iSazonov
InvokeWSMan
de86488
@iSazonov
PingWSMan
09dccd4
@iSazonov
WSManConnections
1286df7
@iSazonov
WSManInstance
3b92bd3
@iSazonov
CommandDiscovery
bd016d6
@iSazonov
CommandInfo
16a1c62
@iSazonov
DataStoreAdapter
dd71c36
@iSazonov
GetCommand
6cc21c2
@iSazonov
Fix typo
8e1cd21
@iSazonov
TypeInferenceVisitor
995395c
@iSazonov
SessionStateLocationAPIs
4ef373e
@iSazonov
CommandHelpProvider
dd74198
@iSazonov
DscResourceHelpProvider
0ae4616
@iSazonov
PSClassHelpProvider
ae52221
@iSazonov
FileSystemContentStream
eedca49
@iSazonov
LocationGlobber
ee9cc41
@iSazonov
NavigationProviderBase
c783f75
@iSazonov Ilya (iSazonov) added the Issue-Code Cleanup the issue is for cleaning up the code with no impact on functionality label Oct 18, 2018
@iSazonov Ilya (iSazonov) self-assigned this Oct 18, 2018
@iSazonov
Ilya (iSazonov) requested review from Travis Plunk (TravisEz13), Dongbo Wang (daxian-dbw) and Staffan Gustafsson (powercode) October 18, 2018 14:29
@iSazonov
Ilya (iSazonov) requested a review from Steve Lee (SteveL-MSFT) October 18, 2018 14:29
@iSazonov
Ilya (iSazonov) requested review from Bruce Payette (BrucePay), Francisco Gamino (Francisco-Gamino), Aditya Patwardhan (adityapatwardhan) and Andrew (anmenaga) as code owners October 18, 2018 14:29
@TravisEz13
Travis Plunk (TravisEz13) requested a review from James Truher (JamesWTruher) October 18, 2018 21:49
@TravisEz13

Travis Plunk (TravisEz13) commented Oct 18, 2018

Copy link
Copy Markdown
Member

src/Microsoft.WSMan.Management/WSManConnections.cs, line 143 at r1 (raw file):

            {
                computername = value;
                if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.OrdinalIgnoreCase)))

I've seen this in many places, perhaps we should have a central place for this code?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

TravisEz13
Travis Plunk (TravisEz13) reviewed Oct 18, 2018
View reviewed changes

@TravisEz13 Travis Plunk (TravisEz13) left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 24 of 24 files at r1.
Reviewable status: :shipit: complete! all files reviewed

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@TravisEz13

Travis Plunk (TravisEz13) commented Oct 18, 2018

Copy link
Copy Markdown
Member

We probably should fix this one as well:

PowerShell/src/System.Management.Automation/engine/parser/SafeValues.cs

Line 641 in 2f1863a

Hashtable hashtable = new Hashtable(StringComparer.CurrentCultureIgnoreCase);

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@TravisEz13

Travis Plunk (TravisEz13) commented Oct 18, 2018

Copy link
Copy Markdown
Member

Thinking about it further with James Truher (@JamesWTruher) , Hashtable could be culture sensitive in some cases. This should be a different PR and probably be behind an experimental flag.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@iSazonov

Ilya (iSazonov) commented Oct 19, 2018

Copy link
Copy Markdown
Collaborator Author

Hashtable could be culture sensitive in some cases.

Travis Plunk (@TravisEz13) In the PR I fixed only obvious cases. There are still about 30 unclear cases left. It would be great if MSFT team reviewed them.

I've seen this in many places, perhaps we should have a central place for this code?

If we should please open a tracking issue and I'll fix this later.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

TravisEz13
Travis Plunk (TravisEz13) approved these changes Oct 20, 2018
View reviewed changes
@iSazonov
Ilya (iSazonov) merged commit 0a4f33a into PowerShell:master Oct 21, 2018
@iSazonov
Ilya (iSazonov) deleted the cleanup-culture branch October 21, 2018 11:11
@iSazonov Ilya (iSazonov) mentioned this pull request Dec 31, 2018
Change hashtable to use OrdinalIgnoreCase to be case-insensitive in all Cultures #8566
Merged
8 of 11 tasks
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@iSazonov
Replace StringComparision.CurrentCulture with StringComparision.Ordin…
5467f7b
…al (PowerShell#8068)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@TravisEz13 Travis Plunk (TravisEz13) TravisEz13 approved these changes
@daxian-dbw Dongbo Wang (daxian-dbw) Awaiting requested review from daxian-dbw daxian-dbw is a code owner
@powercode Staffan Gustafsson (powercode) Awaiting requested review from powercode
@SteveL-MSFT Steve Lee (SteveL-MSFT) Awaiting requested review from SteveL-MSFT
@adityapatwardhan Aditya Patwardhan (adityapatwardhan) Awaiting requested review from adityapatwardhan adityapatwardhan is a code owner
@anmenaga Andrew (anmenaga) Awaiting requested review from anmenaga
@BrucePay Bruce Payette (BrucePay) Awaiting requested review from BrucePay
@Francisco-Gamino Francisco Gamino (Francisco-Gamino) Awaiting requested review from Francisco-Gamino
@JamesWTruher James Truher (JamesWTruher) Awaiting requested review from JamesWTruher

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@iSazonov Ilya (iSazonov)

Labels

Issue-Code Cleanup the issue is for cleaning up the code with no impact on functionality

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@iSazonov @TravisEz13
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.