diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs
index 4f93c63d8d..97a7481ebb 100644
--- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs
@@ -1732,11 +1732,6 @@ namespace Microsoft.PowerShell.Commands
pathNotFound));
return;
}
- catch (SessionStateOverflowException)
- {
- // This is terminating condition
- throw;
- }
catch (SessionStateException sessionStateException)
{
WriteError(
diff --git a/src/System.Management.Automation/engine/DriveInterfaces.cs b/src/System.Management.Automation/engine/DriveInterfaces.cs
index 7226a9657b..d3c8c43561 100644
--- a/src/System.Management.Automation/engine/DriveInterfaces.cs
+++ b/src/System.Management.Automation/engine/DriveInterfaces.cs
@@ -114,10 +114,6 @@ namespace System.Management.Automation
///
/// If the provider threw an exception or returned null.
///
- ///
- ///
- /// If creating the drive will overflow the MaximumDriveCount limit.
- ///
public PSDriveInfo New(PSDriveInfo drive, string scope)
{
Dbg.Diagnostics.Assert(
@@ -173,11 +169,6 @@ namespace System.Management.Automation
///
/// If the provider threw an exception or returned null.
///
- ///
- ///
- /// If creating the drive will overflow the MaximumDriveCount limit.
- ///
- ///
internal void New(
PSDriveInfo drive,
string scope,
diff --git a/src/System.Management.Automation/engine/ExecutionContext.cs b/src/System.Management.Automation/engine/ExecutionContext.cs
index 40384111e8..4eb97effcc 100644
--- a/src/System.Management.Automation/engine/ExecutionContext.cs
+++ b/src/System.Management.Automation/engine/ExecutionContext.cs
@@ -802,39 +802,8 @@ namespace System.Management.Automation
return;
}
- // 1045384-2004/12/14-JonN implementing $MaximumErrorCount
- object maxcountobj = EngineSessionState.CurrentScope.ErrorCapacity.FastValue;
- if (null != maxcountobj)
- {
- try
- {
- maxcountobj = LanguagePrimitives.ConvertTo(maxcountobj, typeof(int), CultureInfo.InvariantCulture);
- }
- catch (PSInvalidCastException)
- {
- }
- catch (System.OverflowException)
- {
- }
- catch (Exception e)
- {
- Diagnostics.Assert(false,
- "Unexpected exception in LanguagePrimitives.ConvertTo: "
- + e.GetType().FullName);
- throw;
- }
- }
- int maxErrorCount = (maxcountobj is int) ? (int)maxcountobj : 256;
- if (0 > maxErrorCount)
- maxErrorCount = 0;
- else if (32768 < maxErrorCount)
- maxErrorCount = 32768;
+ const int maxErrorCount = 256;
- if (0 >= maxErrorCount)
- {
- arraylist.Clear();
- return;
- }
int numToErase = arraylist.Count - (maxErrorCount - 1);
if (0 < numToErase)
{
diff --git a/src/System.Management.Automation/engine/InitialSessionState.cs b/src/System.Management.Automation/engine/InitialSessionState.cs
index f8c6ae7824..6d15f97a11 100644
--- a/src/System.Management.Automation/engine/InitialSessionState.cs
+++ b/src/System.Management.Automation/engine/InitialSessionState.cs
@@ -3138,7 +3138,6 @@ namespace System.Management.Automation.Runspaces
catch (NotSupportedException e) { ex = e; }
catch (ProviderNotFoundException e) { ex = e; }
catch (ProviderInvocationException e) { ex = e; }
- catch (SessionStateOverflowException e) { ex = e; }
catch (KeyNotFoundException e) { ex = e; }
catch (IOException e) { ex = e; }
catch (UnauthorizedAccessException e) { ex = e; }
diff --git a/src/System.Management.Automation/engine/InternalCommands.cs b/src/System.Management.Automation/engine/InternalCommands.cs
index 65daebd1c8..9bbf60ea3f 100644
--- a/src/System.Management.Automation/engine/InternalCommands.cs
+++ b/src/System.Management.Automation/engine/InternalCommands.cs
@@ -158,9 +158,6 @@ namespace Microsoft.PowerShell.Commands
///
/// Execute the begin scriptblock at the start of processing
///
- ///
- /// The maximum scope depth would be exceeded
- ///
/// could not parse script
/// see Pipeline.Invoke
/// see Pipeline.Invoke
@@ -242,9 +239,6 @@ namespace Microsoft.PowerShell.Commands
/// Execute the processing script blocks on the current pipeline object
/// which is passed as it's only parameter.
///
- ///
- /// The maximum scope depth would be exceeded
- ///
/// could not parse script
/// see Pipeline.Invoke
/// see Pipeline.Invoke
@@ -733,9 +727,6 @@ namespace Microsoft.PowerShell.Commands
///
/// Execute the end scriptblock when the pipeline is complete
///
- ///
- /// The maximum scope depth would be exceeded
- ///
/// could not parse script
/// see Pipeline.Invoke
/// see Pipeline.Invoke
@@ -1456,9 +1447,6 @@ namespace Microsoft.PowerShell.Commands
/// Execute the script block passing in the current pipeline object as
/// it's only parameter.
///
- ///
- /// The maximum scope depth would be exceeded
- ///
/// could not parse script
/// see Pipeline.Invoke
/// see Pipeline.Invoke
diff --git a/src/System.Management.Automation/engine/Modules/PSModuleInfo.cs b/src/System.Management.Automation/engine/Modules/PSModuleInfo.cs
index 01c6376a1c..3a0e9f4af1 100644
--- a/src/System.Management.Automation/engine/Modules/PSModuleInfo.cs
+++ b/src/System.Management.Automation/engine/Modules/PSModuleInfo.cs
@@ -1058,8 +1058,7 @@ namespace System.Management.Automation
}
internal static string[] _builtinVariables = new string[] { "_", "this", "input", "args", "true", "false", "null",
- "MaximumErrorCount", "MaximumVariableCount", "MaximumFunctionCount","MaximumAliasCount", "PSDefaultParameterValues",
- "MaximumDriveCount", "Error", "PSScriptRoot", "PSCommandPath", "MyInvocation", "ExecutionContext", "StackTrace" };
+ "PSDefaultParameterValues", "Error", "PSScriptRoot", "PSCommandPath", "MyInvocation", "ExecutionContext", "StackTrace" };
///
/// Lists the variables exported by this module.
diff --git a/src/System.Management.Automation/engine/MshMemberInfo.cs b/src/System.Management.Automation/engine/MshMemberInfo.cs
index cb54fc1b96..a8a85c9e07 100644
--- a/src/System.Management.Automation/engine/MshMemberInfo.cs
+++ b/src/System.Management.Automation/engine/MshMemberInfo.cs
@@ -1846,10 +1846,6 @@ namespace System.Management.Automation
args: new object[] { value });
return value;
}
- catch (SessionStateOverflowException e)
- {
- throw NewSetValueException(e, "ScriptSetValueSessionStateOverflowException");
- }
catch (RuntimeException e)
{
throw NewSetValueException(e, "ScriptSetValueRuntimeException");
@@ -1881,10 +1877,6 @@ namespace System.Management.Automation
scriptThis: scriptThis,
args: Utils.EmptyArray