private void DisposeCommands() { this.stopping = true; this.FlushLog(); if (this._commands != null) { for (int i = 0; i < this._commands.Count; i++) { CommandProcessorBase base2 = this._commands[i]; if (base2 != null) { try { base2.CommandRuntime.RemoveVariableListsInPipe(); base2.Dispose(); } catch (Exception exception) { CommandProcessorBase.CheckForSevereException(exception); InvocationInfo myInvocation = null; if (base2.Command != null) { myInvocation = base2.Command.MyInvocation; } ProviderInvocationException innerException = exception as ProviderInvocationException; if (innerException != null) { exception = new CmdletProviderInvocationException(innerException, myInvocation); } else { exception = new CmdletInvocationException(exception, myInvocation); MshLog.LogCommandHealthEvent(base2.Command.Context, exception, Severity.Warning); } this.RecordFailure(exception, base2.Command); } } } } this._commands = null; if (this._redirectionPipes != null) { foreach (PipelineProcessor processor in this._redirectionPipes) { try { if (processor != null) { processor.Dispose(); } } catch (Exception exception3) { CommandProcessorBase.CheckForSevereException(exception3); } } } this._redirectionPipes = null; }