Exemplo n.º 1
0
            static void OnOpenComplete(IAsyncResult result)
            {
                if (result.CompletedSynchronously)
                {
                    return;
                }

                OpenAsyncResult thisPtr   = (OpenAsyncResult)result.AsyncState;
                Exception       exception = null;

                try
                {
                    thisPtr.communicationObject.EndOpen(result);
                }
#pragma warning suppress 56500 // covered by FxCOP
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }

                    exception = e;
                }

                thisPtr.Complete(false, exception);
            }
Exemplo n.º 2
0
            private static void OnOpenComplete(IAsyncResult result)
            {
                if (result.CompletedSynchronously)
                {
                    return;
                }

                OpenAsyncResult thisPtr   = (OpenAsyncResult)result.AsyncState;
                Exception       exception = null;

                try
                {
                    thisPtr.communicationObject.EndOpen(result);
                }
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }

                    exception = e;
                }

                thisPtr.Complete(false, exception);
            }
Exemplo n.º 3
0
            static void OnRequestCompleteStatic(IAsyncResult result)
            {
                if (result.CompletedSynchronously)
                {
                    return;
                }

                OpenAsyncResult openResult = (OpenAsyncResult)result.AsyncState;
                Exception       exception  = null;

                try
                {
                    openResult.CompleteRequest(result);
                }
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }

                    exception = e;
                }

                openResult.Complete(false, exception);
            }
Exemplo n.º 4
0
                static void OpenInnerChannelCallback(IAsyncResult result)
                {
                    if (result == null)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("result"));
                    }
                    if (result.CompletedSynchronously)
                    {
                        return;
                    }
                    OpenAsyncResult self = result.AsyncState as OpenAsyncResult;

                    if (self == null)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.InvalidAsyncResult), "result"));
                    }
                    Exception completionException = null;

                    try
                    {
                        self.clientChannel.InnerChannel.EndOpen(result);
                    }
#pragma warning suppress 56500 // covered by FxCOP
                    catch (Exception e)
                    {
                        if (Fx.IsFatal(e))
                        {
                            throw;
                        }
                        completionException = e;
                    }
                    self.Complete(false, completionException);
                }
Exemplo n.º 5
0
    public IAsyncResult DefaultOnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
    {
        // Modify the placeholder async result we already instantiated.
        OpenAsyncResult.Callback   = callback;
        OpenAsyncResult.AsyncState = state;

        // The mock always Completes the IAsyncResult before handing it back.
        // This is done because the sync path has no access to this IAsyncResult
        // that happens behind the scenes.
        OpenAsyncResult.Complete();

        return(OpenAsyncResult);
    }