-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Resolution-AnsweredThe question is answered.The question is answered.
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
Steps to reproduce:
Script
function Get-HashSet {
$hashSet = [System.Collections.Generic.HashSet[string]]::new([System.StringComparer]::OrdinalIgnoreCase)
$hashSet.Add("ABCD1")
$hashSet.Add("ABCD2")
return $hashSet
}
# Get the HashSet reference from the function
$myHashSet = Get-HashSet
# Check if the same reference is maintained and comparer works
$myHashSet.Contains("abcd1") # Should return True, But Retuning False
# do same with hasset created outside of function
$hashSetInline = [System.Collections.Generic.HashSet[string]]::new([System.StringComparer]::OrdinalIgnoreCase)
$hashSetInline.Add("ABCD1") | Out-Null
$hashSetInline.Add("ABCD2") | Out-Null
$hashSetInline.Contains("abcd1") #Returns True as expected
$PSVersionTable
Expected behavior
True
TrueActual behavior
False
TrueError details
No response
Environment data
Name Value
---- -----
PSVersion 7.5.0-preview.5
PSEdition Core
GitCommitId 7.5.0-preview.5
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
and on all old versionsVisuals
No response
Metadata
Metadata
Assignees
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Resolution-AnsweredThe question is answered.The question is answered.