Skip to content

Fix parameter name in the Get-Variable cmdlet error message. - #7384

Merged
Ilya (iSazonov) merged 4 commits into
PowerShell:masterfrom
sethvs:scopeID
Jul 31, 2018
Merged

Ilya (iSazonov) merged 4 commits into
PowerShell:masterfrom
sethvs:scopeID

Conversation

@sethvs

Copy link
Copy Markdown
Contributor

PR Summary

When using Get-Variable (or Get-Alias) cmdlet with the -Scope parameter with wrong value, the error message refers to scopeID parameter.
Even though it is the real parameter of the GetScopeByID and GetScopeByID internal methods, the error message returns to the user, who used the -Scope parameter.

Fix #7383

PR Checklist

if (scopeNumericID < 0)
{
throw PSTraceSource.NewArgumentOutOfRangeException("scopeID", scopeID);
throw PSTraceSource.NewArgumentOutOfRangeException("Scope", scopeID);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We could use "readonly const".

@iSazonov Ilya (iSazonov) self-assigned this Jul 30, 2018

/// <summary>
/// Cmdlet parameter name to return in the error message
/// instead of "scopeID".

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I suppose we could put it in one line - 100-120 characters is not a problem for modern displays.

@iSazonov
Ilya (iSazonov) merged commit fcc519b into PowerShell:master Jul 31, 2018
@iSazonov

Copy link
Copy Markdown
Collaborator

Sergey Vasin (@sethvs) Thanks for the fix!

@sethvs
Sergey Vasin (sethvs) deleted the scopeID branch September 27, 2018 11:21
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
…ell#7384)

Before the fix when using Get-Variable or Get-Alias cmdlets with the -Scope parameter with wrong value, the error message refers to 'scopeID' parameter instead of 'Scope'.
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.

Wrong parameter name in the Get-Variable cmdlet error message.

3 participants