private static void OnUpgrade(IAsyncResult result) { if (result.CompletedSynchronously) { return; } Microsoft.ServiceBus.Channels.ClientFramingDuplexSessionChannel.SendPreambleAsyncResult asyncState = (Microsoft.ServiceBus.Channels.ClientFramingDuplexSessionChannel.SendPreambleAsyncResult)result.AsyncState; bool flag = false; Exception exception = null; try { flag = asyncState.HandleUpgrade(result); } catch (Exception exception2) { Exception exception1 = exception2; if (Fx.IsFatal(exception1)) { throw; } flag = true; exception = exception1; } if (flag) { asyncState.Complete(false, exception); } }