internal Pipeline(Runspace runspace, CommandCollection command) { using (Pipeline._trace.TraceConstructor((object)this)) { if (runspace == null) { Pipeline._trace.NewArgumentNullException(nameof(runspace)); } this._pipelineId = runspace.GeneratePipelineId(); this._commands = command; } }
/// <summary> /// Constructor to initialize both Runspace and Command to invoke. /// Caller should make sure that "command" is not null. /// </summary> /// <param name="runspace"> /// Runspace to use for the command invocation. /// </param> /// <param name="command"> /// command to Invoke. /// Caller should make sure that "command" is not null. /// </param> internal Pipeline(Runspace runspace, CommandCollection command) { if (runspace == null) { PSTraceSource.NewArgumentNullException(nameof(runspace)); } // This constructor is used only internally. // Caller should make sure the input is valid Dbg.Assert(command != null, "Command cannot be null"); InstanceId = runspace.GeneratePipelineId(); Commands = command; // Reset the AMSI session so that it is re-initialized // when the next script block is parsed. AmsiUtils.CloseSession(); }
/// <summary> /// Constructor to initialize both Runspace and Command to invoke. /// Caller should make sure that "command" is not null. /// </summary> /// <param name="runspace"> /// Runspace to use for the command invocation. /// </param> /// <param name="command"> /// command to Invoke. /// Caller should make sure that "command" is not null. /// </param> internal Pipeline(Runspace runspace, CommandCollection command) { if (runspace == null) { PSTraceSource.NewArgumentNullException("runspace"); } // This constructor is used only internally. // Caller should make sure the input is valid Dbg.Assert(null != command, "Command cannot be null"); InstanceId = runspace.GeneratePipelineId(); Commands = command; // Reset the AMSI session so that it is re-initialized // when the next script block is parsed. AmsiUtils.CloseSession(); }