internal override void CloseAsync() { BaseClientTransportManager.tracer.WriteLine("Closing command with command context: {0} Operation Context {1}", new object[] { this.cmdContextId, this.wsManCmdOperationHandle }); bool flag = false; lock (base.syncObject) { if (base.isClosed) { return; } base.isClosed = true; if (IntPtr.Zero == this.wsManCmdOperationHandle) { flag = true; } } base.CloseAsync(); if (!flag) { PSEtwLog.LogAnalyticInformational(PSEventId.WSManCloseCommand, PSOpcode.Disconnect, PSTask.None, PSKeyword.Transport | PSKeyword.UseAlwaysAnalytic, new object[] { base.RunspacePoolInstanceId.ToString(), this.powershellInstanceId.ToString() }); this.closeCmdCompleted = new WSManNativeApi.WSManShellAsync(new IntPtr(this.cmdContextId), cmdCloseCallback); WSManNativeApi.WSManCloseCommand(this.wsManCmdOperationHandle, 0, (IntPtr)this.closeCmdCompleted); } else { try { base.RaiseCloseCompleted(); } finally { RemoveCmdTransportManager(this.cmdContextId); } } }
internal override void CloseAsync() { BaseClientTransportManager.tracer.WriteLine("Closing command with command context: {0} Operation Context {1}", (object)this.cmdContextId, (object)this.wsManCmdOperationHandle); bool flag = false; lock (this.syncObject) { if (this.isClosed) { return; } this.isClosed = true; if (IntPtr.Zero == this.wsManCmdOperationHandle) { flag = true; } } base.CloseAsync(); if (flag) { try { this.RaiseCloseCompleted(); } finally { WSManClientCommandTransportManager.RemoveCmdTransportManager(this.cmdContextId); } } else { BaseTransportManager.ETWTracer.AnalyticChannel.WriteInformation(PSEventId.WSManCloseCommand, PSOpcode.Disconnect, PSTask.None, (object)this.RunspacePoolInstanceId, (object)this.powershellInstanceId); this.closeCmdCompleted = new WSManNativeApi.WSManShellAsync(new IntPtr(this.cmdContextId), WSManClientCommandTransportManager.cmdCloseCallback); WSManNativeApi.WSManCloseCommand(this.wsManCmdOperationHandle, 0, (IntPtr)this.closeCmdCompleted); } }