Skip to content

Conversation

@sethvs
Copy link
Contributor

@sethvs sethvs commented Jul 27, 2018

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
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 iSazonov self-assigned this Jul 30, 2018

/// <summary>
/// Cmdlet parameter name to return in the error message
/// instead of "scopeID".
Copy link
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 iSazonov merged commit fcc519b into PowerShell:master Jul 31, 2018
@iSazonov
Copy link
Collaborator

@sethvs Thanks for the fix!

@sethvs sethvs deleted the scopeID branch September 27, 2018 11:21
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