Skip to content

Conversation

@BrucePay
Copy link
Collaborator

@BrucePay BrucePay commented Jun 20, 2018

PR Summary

Fix #6933.

Modified the Group-Object -AsHashTable code to get the base object from the PSObject before using the value to create a key in the hashtable.

PR Checklist

if (_grp.Values.Count == 1)
{
_table.Add(_grp.Values[0], _grp.Group);
_table.Add(PSObject.Base(_grp.Values[0]), _grp.Group);
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest leaving a comment here since the change is rather subtle; otherwise, the change looks good to me.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, the comment would be useful.

$result['Failed'].ErrorMessage.Count | Should -Be 5
$result['Failed'].ErrorMessage[0] | Should -Be 'SomeError'
$result['Successful'].ErrorMessage.Count | Should -Be 4
$result['Successful'].ErrorMessage[0] | Should -Be ''
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we use more readable value instead of ''?

Copy link
Contributor

@PaulHigin PaulHigin left a comment

Choose a reason for hiding this comment

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

LGTM

@powercode
Copy link
Collaborator

@BrucePay Thanks for this! I've wanted to use it several times but always ended up being frustrated.

@iSazonov iSazonov changed the title Fix #6933 Modified the -AsHashTable code to get the base object from the PSObject for the hashtable. Modify the -AsHashTable code to get the base object from the PSObject for the hashtable. Jun 28, 2018
@iSazonov iSazonov merged commit 1d54949 into PowerShell:master Jun 28, 2018
@iSazonov
Copy link
Collaborator

@BrucePay I added "Fix #6933" to the PR description to automatically close the fixed issue after the PR is merged - no needs add this in PR header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GroupObject -AsHashTable should "core" any PSObjects being used as keys

5 participants