diff --git a/src/System.Management.Automation/engine/SessionStateScopeAPIs.cs b/src/System.Management.Automation/engine/SessionStateScopeAPIs.cs
index 2c7850f179..a6196e4905 100644
--- a/src/System.Management.Automation/engine/SessionStateScopeAPIs.cs
+++ b/src/System.Management.Automation/engine/SessionStateScopeAPIs.cs
@@ -21,6 +21,11 @@ namespace System.Management.Automation
///
private SessionStateScope _currentScope;
+ ///
+ /// Cmdlet parameter name to return in the error message instead of "scopeID".
+ ///
+ internal const string ScopeParameterName = "Scope";
+
///
/// Given a scope identifier, returns the proper session state scope.
///
@@ -92,18 +97,18 @@ namespace System.Management.Automation
if (scopeNumericID < 0)
{
- throw PSTraceSource.NewArgumentOutOfRangeException("scopeID", scopeID);
+ throw PSTraceSource.NewArgumentOutOfRangeException(ScopeParameterName, scopeID);
}
result = GetScopeByID(scopeNumericID) ?? _currentScope;
}
catch (FormatException)
{
- throw PSTraceSource.NewArgumentException("scopeID", AutomationExceptions.InvalidScopeIdArgument, "scopeID");
+ throw PSTraceSource.NewArgumentException(ScopeParameterName, AutomationExceptions.InvalidScopeIdArgument, ScopeParameterName);
}
catch (OverflowException)
{
- throw PSTraceSource.NewArgumentOutOfRangeException("scopeID", scopeID);
+ throw PSTraceSource.NewArgumentOutOfRangeException(ScopeParameterName, scopeID);
}
}
}
@@ -144,7 +149,7 @@ namespace System.Management.Automation
{
ArgumentOutOfRangeException outOfRange =
PSTraceSource.NewArgumentOutOfRangeException(
- "scopeID",
+ ScopeParameterName,
originalID,
SessionStateStrings.ScopeIDExceedsAvailableScopes,
originalID);
diff --git a/src/System.Management.Automation/resources/AutomationExceptions.resx b/src/System.Management.Automation/resources/AutomationExceptions.resx
index e48937c909..6c4c8fe0d9 100644
--- a/src/System.Management.Automation/resources/AutomationExceptions.resx
+++ b/src/System.Management.Automation/resources/AutomationExceptions.resx
@@ -121,7 +121,7 @@
Cannot process argument because the value of argument "{0}" is not valid. Change the value of the "{0}" argument and run the operation again.
- Cannot process argument because the value of argument "{0}" is not valid. Valid values are "Global", "Local", or "Script", or a number relative to the current scope (0 through the number of scopes where 0 is the current scope and 1 is its parent). Change the value of the "{0}" argument and run the operation again.
+ Cannot process argument because the value of parameter "{0}" is not valid. Valid values are "Global", "Local", or "Script", or a number relative to the current scope (0 through the number of scopes where 0 is the current scope and 1 is its parent). Change the value of the "{0}" parameter and run the operation again.
Cannot process argument because the value of argument "{0}" is null. Change the value of argument "{0}" to a non-null value.