private static void OnEnterComplete(object state, Exception asyncException) { FramingDuplexSessionChannel.CloseOutputSessionAsyncResult result = (FramingDuplexSessionChannel.CloseOutputSessionAsyncResult)state; bool flag = false; Exception exception = asyncException; if (exception != null) { flag = true; } else { try { flag = result.WriteEndBytes(); } catch (Exception exception2) { if (Fx.IsFatal(exception2)) { throw; } flag = true; exception = exception2; } } if (flag) { result.Cleanup(exception == null, asyncException == null); result.Complete(false, exception); } }
private static void OnWriteComplete(IAsyncResult result) { if (!result.CompletedSynchronously) { FramingDuplexSessionChannel.CloseOutputSessionAsyncResult asyncState = (FramingDuplexSessionChannel.CloseOutputSessionAsyncResult)result.AsyncState; Exception exception = null; try { asyncState.HandleWriteEndBytesComplete(result); } catch (Exception exception2) { if (Fx.IsFatal(exception2)) { throw; } exception = exception2; } asyncState.Cleanup(exception == null, true); asyncState.Complete(false, exception); } }