예제 #1
0
                private static void OpenInnerChannelCallback(IAsyncResult result)
                {
                    if (result == null)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError((Exception) new ArgumentNullException("result"));
                    }
                    if (result.CompletedSynchronously)
                    {
                        return;
                    }
                    SecurityChannelFactory <TChannel> .ClientSecurityChannel <UChannel> .OpenAsyncResult asyncState = result.AsyncState as SecurityChannelFactory <TChannel> .ClientSecurityChannel <UChannel> .OpenAsyncResult;
                    if (asyncState == null)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError((Exception) new ArgumentException(SR.GetString("InvalidAsyncResult"), "result"));
                    }
                    Exception exception = (Exception)null;

                    try
                    {
                        asyncState.clientChannel.InnerChannel.EndOpen(result);
                    }
                    catch (Exception ex)
                    {
                        if (Fx.IsFatal(ex))
                        {
                            throw;
                        }
                        else
                        {
                            exception = ex;
                        }
                    }
                    asyncState.Complete(false, exception);
                }
예제 #2
0
 private static void OpenSecurityProtocolCallback(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         SecurityChannelFactory <TChannel> .ClientSecurityChannel <UChannel> .OpenAsyncResult asyncState = result.AsyncState as SecurityChannelFactory <TChannel> .ClientSecurityChannel <UChannel> .OpenAsyncResult;
         if (asyncState == null)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.ServiceModel.SR.GetString("InvalidAsyncResult"), "result"));
         }
         Exception exception = null;
         bool      flag      = false;
         try
         {
             asyncState.clientChannel.SecurityProtocol.EndOpen(result);
             flag = asyncState.OnSecurityProtocolOpenComplete();
         }
         catch (Exception exception2)
         {
             if (Fx.IsFatal(exception2))
             {
                 throw;
             }
             exception = exception2;
             flag      = true;
         }
         if (flag)
         {
             asyncState.Complete(false, exception);
         }
     }
 }
예제 #3
0
                private static void OpenSecurityProtocolCallback(IAsyncResult result)
                {
                    if (result.CompletedSynchronously)
                    {
                        return;
                    }
                    SecurityChannelFactory <TChannel> .ClientSecurityChannel <UChannel> .OpenAsyncResult asyncState = result.AsyncState as SecurityChannelFactory <TChannel> .ClientSecurityChannel <UChannel> .OpenAsyncResult;
                    if (asyncState == null)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError((Exception) new ArgumentException(SR.GetString("InvalidAsyncResult"), "result"));
                    }
#if FEATURE_CORECLR
                    throw new NotImplementedException("SecurityProtocol.EndOpen is not supported in .NET Core");
#else
                    Exception exception = (Exception)null;
                    bool      flag;
                    try
                    {
                        asyncState.clientChannel.SecurityProtocol.EndOpen(result);
                        flag = asyncState.OnSecurityProtocolOpenComplete();
                    }
                    catch (Exception ex)
                    {
                        if (Fx.IsFatal(ex))
                        {
                            throw;
                        }
                        else
                        {
                            exception = ex;
                            flag      = true;
                        }
                    }
                    if (!flag)
                    {
                        return;
                    }
                    asyncState.Complete(false, exception);
#endif
                }