8000 Return casesensitive hashtable with Group-Object · Issue #10441 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Return casesensitive hashtable with Group-Object #10441

@lahell

Description

@lahell

Steps to reproduce

I know PowerShell is mostly case insensitive, but when using both -AsHashTable and -CaseSensitive I expected to end up with a case sensitive hashtable.

$capitonyms = @(
    [PSCustomObject]@{
        Capitonym = 'Bill'
    }
    [PSCustomObject]@{
        Capitonym = 'bill'
    }
)

$capitonyms | Group-Object Capitonym -AsHashTable -CaseSensitive

Expected behavior

Name                           Value
----                           -----
Bill                           {@{Capitonym=Bill}}
bill                           {@{Capitonym=bill}}

Actual behavior

Group-Object : The objects grouped by this property cannot be expanded because there is a key duplication. Provide a valid value for the property, and then try again.
At line:1 char:15
+ $capitonyms | Group-Object Capitonym -AsHashTable -CaseSensitive
+               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (:) [Group-Object], Exception
+ FullyQualifiedErrorId : The objects grouped by this property cannot be expanded because there is a key duplication. Provide a valid value for the property, and then try again.,Microsoft.PowerShell.Commands.GroupObjectCommand

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.0-preview.3
PSEdition                      Core
GitCommitId                    7.0.0-preview.3
OS                             Microsoft Windows 10.0.18362
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Breaking-Changebreaking change that may affect usersIssue-Enhancementthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0