GetBreakpoints() =>
_wrappedDebugger.Value.GetBreakpoints();
+ public override CommandBreakpoint SetCommandBreakpoint(string command, ScriptBlock action = null, string path = null) =>
+ _wrappedDebugger.Value.SetCommandBreakpoint(command, action, path);
+
+ public override LineBreakpoint SetLineBreakpoint(string path, int line, int column = 0, ScriptBlock action = null) =>
+ _wrappedDebugger.Value.SetLineBreakpoint(path, line, column, action);
+
+ public override VariableBreakpoint SetVariableBreakpoint(string variableName, VariableAccessMode accessMode = VariableAccessMode.Write, ScriptBlock action = null, string path = null) =>
+ _wrappedDebugger.Value.SetVariableBreakpoint(variableName, accessMode, action, path);
+
+ public override bool RemoveBreakpoint(Breakpoint breakpoint) =>
+ _wrappedDebugger.Value.RemoveBreakpoint(breakpoint);
+
+ public override Breakpoint EnableBreakpoint(Breakpoint breakpoint) =>
+ _wrappedDebugger.Value.EnableBreakpoint(breakpoint);
+
+ public override Breakpoint DisableBreakpoint(Breakpoint breakpoint) =>
+ _wrappedDebugger.Value.DisableBreakpoint(breakpoint);
+
///
/// Exits debugger mode with the provided resume action.
///
@@ -1855,13 +1993,15 @@ internal override DebuggerCommand InternalProcessCommand(string command, IList
///
- /// Job object that is either a debuggable job or a container
- /// of debuggable child jobs.
+ /// Job object that is either a debuggable job or a container of
+ /// debuggable child jobs.
///
- internal override void DebugJob(Job job)
- {
- _wrappedDebugger.Value.DebugJob(job);
- }
+ ///
+ /// If true, the debugger automatically invokes a break all when it
+ /// attaches to the job.
+ ///
+ internal override void DebugJob(Job job, bool breakAll) =>
+ _wrappedDebugger.Value.DebugJob(job, breakAll);
///
/// Removes job from debugger job list and pops its
@@ -1876,20 +2016,16 @@ internal override void StopDebugJob(Job job)
///
/// Sets up debugger to debug provided Runspace in a nested debug session.
///
- /// Runspace to debug.
- internal override void DebugRunspace(Runspace runspace)
- {
- _wrappedDebugger.Value.DebugRunspace(runspace);
- }
-
- ///
- /// Sets up debugger to debug provided Runspace in a nested debug session.
- ///
- /// Runspace to debug.
- ///
- internal override void DebugRunspace(Runspace runspace, bool disableBreakAll)
+ ///
+ /// Runspace to debug.
+ ///
+ ///
+ /// When true, this command will invoke a BreakAll when the debugger is
+ /// first attached.
+ ///
+ internal override void DebugRunspace(Runspace runspace, bool breakAll)
{
- _wrappedDebugger.Value.DebugRunspace(runspace, disableBreakAll);
+ _wrappedDebugger.Value.DebugRunspace(runspace, breakAll);
}
///
diff --git a/src/System.Management.Automation/engine/remoting/server/serverremotesession.cs b/src/System.Management.Automation/engine/remoting/server/serverremotesession.cs
index 004f5fb00e9..dc740ec962a 100644
--- a/src/System.Management.Automation/engine/remoting/server/serverremotesession.cs
+++ b/src/System.Management.Automation/engine/remoting/server/serverremotesession.cs
@@ -89,6 +89,9 @@ internal class ServerRemoteSession : RemoteSession
// Creates a pushed remote runspace session created with this configuration name.
private string _configurationName;
+ // Specifies an initial location of the powershell session.
+ private string _initialLocation;
+
#region Events
///
/// Raised when session is closed.
@@ -176,6 +179,7 @@ internal ServerRemoteSession(PSSenderInfo senderInfo,
///
///
/// Optional configuration endpoint name for OutOfProc sessions.
+ /// Optional configuration initial location of the powershell session.
///
///
/// InitialSessionState provider with does
@@ -188,13 +192,16 @@ internal ServerRemoteSession(PSSenderInfo senderInfo,
...
*/
- internal static ServerRemoteSession CreateServerRemoteSession(PSSenderInfo senderInfo,
+ internal static ServerRemoteSession CreateServerRemoteSession(
+ PSSenderInfo senderInfo,
string configurationProviderId,
string initializationParameters,
AbstractServerSessionTransportManager transportManager,
- string configurationName = null)
+ string configurationName = null,
+ string initialLocation = null)
{
- Dbg.Assert((senderInfo != null) & (senderInfo.UserInfo != null),
+ Dbg.Assert(
+ (senderInfo != null) && (senderInfo.UserInfo != null),
"senderInfo and userInfo cannot be null.");
s_trace.WriteLine("Finding InitialSessionState provider for id : {0}", configurationProviderId);
@@ -207,12 +214,14 @@ internal static ServerRemoteSession CreateServerRemoteSession(PSSenderInfo sende
string shellPrefix = System.Management.Automation.Remoting.Client.WSManNativeApi.ResourceURIPrefix;
int index = configurationProviderId.IndexOf(shellPrefix, StringComparison.OrdinalIgnoreCase);
senderInfo.ConfigurationName = (index == 0) ? configurationProviderId.Substring(shellPrefix.Length) : string.Empty;
- ServerRemoteSession result = new ServerRemoteSession(senderInfo,
+ ServerRemoteSession result = new ServerRemoteSession(
+ senderInfo,
configurationProviderId,
initializationParameters,
transportManager)
{
- _configurationName = configurationName
+ _configurationName = configurationName,
+ _initialLocation = initialLocation
};
// start state machine.
@@ -229,14 +238,22 @@ internal static ServerRemoteSession CreateServerRemoteSession(PSSenderInfo sende
///
///
///
+ ///
///
- internal static ServerRemoteSession CreateServerRemoteSession(PSSenderInfo senderInfo,
+ internal static ServerRemoteSession CreateServerRemoteSession(
+ PSSenderInfo senderInfo,
string initializationScriptForOutOfProcessRunspace,
AbstractServerSessionTransportManager transportManager,
- string configurationName)
+ string configurationName,
+ string initialLocation)
{
- ServerRemoteSession result = CreateServerRemoteSession(senderInfo,
- "Microsoft.PowerShell", string.Empty, transportManager, configurationName);
+ ServerRemoteSession result = CreateServerRemoteSession(
+ senderInfo,
+ "Microsoft.PowerShell",
+ string.Empty,
+ transportManager,
+ configurationName: configurationName,
+ initialLocation: initialLocation);
result._initScriptForOutOfProcRS = initializationScriptForOutOfProcessRunspace;
return result;
}
@@ -885,7 +902,8 @@ private void HandleCreateRunspacePool(object sender, RemoteDataEventArgs createR
isAdministrator,
Context.ServerCapability,
psClientVersion,
- _configurationName);
+ _configurationName,
+ _initialLocation);
// attach the necessary event handlers and start the driver.
Interlocked.Exchange(ref _runspacePoolDriver, tmpDriver);
diff --git a/src/System.Management.Automation/help/HelpErrorTracer.cs b/src/System.Management.Automation/help/HelpErrorTracer.cs
index 185601e52a9..6a2ae124955 100644
--- a/src/System.Management.Automation/help/HelpErrorTracer.cs
+++ b/src/System.Management.Automation/help/HelpErrorTracer.cs
@@ -1,9 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-using System.Collections;
+using System.Collections.Generic;
using System.Collections.ObjectModel;
-using System.Reflection;
namespace System.Management.Automation
{
@@ -134,7 +133,7 @@ internal HelpErrorTracer(HelpSystem helpSystem)
///
/// This tracks all live TraceFrame objects, which forms a stack.
///
- private ArrayList _traceFrames = new ArrayList();
+ private readonly List _traceFrames = new List();
///
/// This is the API to use for starting a help trace scope.
@@ -160,7 +159,7 @@ internal void TraceError(ErrorRecord errorRecord)
if (_traceFrames.Count <= 0)
return;
- TraceFrame traceFrame = (TraceFrame)_traceFrames[_traceFrames.Count - 1];
+ TraceFrame traceFrame = _traceFrames[_traceFrames.Count - 1];
traceFrame.TraceError(errorRecord);
}
@@ -175,7 +174,7 @@ internal void TraceErrors(Collection errorRecords)
if (_traceFrames.Count <= 0)
return;
- TraceFrame traceFrame = (TraceFrame)_traceFrames[_traceFrames.Count - 1];
+ TraceFrame traceFrame = _traceFrames[_traceFrames.Count - 1];
traceFrame.TraceErrors(errorRecords);
}
@@ -185,7 +184,7 @@ internal void PopFrame(TraceFrame traceFrame)
if (_traceFrames.Count <= 0)
return;
- TraceFrame lastFrame = (TraceFrame)_traceFrames[_traceFrames.Count - 1];
+ TraceFrame lastFrame = _traceFrames[_traceFrames.Count - 1];
if (lastFrame == traceFrame)
{
diff --git a/src/System.Management.Automation/help/MUIFileSearcher.cs b/src/System.Management.Automation/help/MUIFileSearcher.cs
index fb31de950c7..354cc9c4d10 100644
--- a/src/System.Management.Automation/help/MUIFileSearcher.cs
+++ b/src/System.Management.Automation/help/MUIFileSearcher.cs
@@ -118,7 +118,7 @@ private string[] GetFiles(string path, string pattern)
#if UNIX
// On Linux, file names are case sensitive, so we need to add
// extra logic to select the files that match the given pattern.
- ArrayList result = new ArrayList();
+ var result = new List();
string[] files = Directory.GetFiles(path);
var wildcardPattern = WildcardPattern.ContainsWildcardCharacters(pattern)
@@ -143,7 +143,7 @@ private string[] GetFiles(string path, string pattern)
}
}
- return (string[])result.ToArray(typeof(string));
+ return result.ToArray();
#else
return Directory.GetFiles(path, pattern);
#endif
diff --git a/src/System.Management.Automation/namespaces/FileSystemContentStream.cs b/src/System.Management.Automation/namespaces/FileSystemContentStream.cs
index f18bb477028..4d7dae05950 100644
--- a/src/System.Management.Automation/namespaces/FileSystemContentStream.cs
+++ b/src/System.Management.Automation/namespaces/FileSystemContentStream.cs
@@ -344,7 +344,7 @@ public IList Read(long readCount)
s_tracer.WriteLine("blocks requested = {0}", readCount);
- ArrayList blocks = new ArrayList();
+ var blocks = new List