Beispiel #1
0
            static void OnEnterComplete(object state, Exception asyncException)
            {
                SendAsyncResult thisPtr             = (SendAsyncResult)state;
                bool            completeSelf        = false;
                Exception       completionException = asyncException;

                if (completionException != null)
                {
                    completeSelf = true;
                }
                else
                {
                    try
                    {
                        completeSelf = thisPtr.WriteCore();
                    }
#pragma warning suppress 56500 // [....], transferring exception to another thread
                    catch (Exception e)
                    {
                        if (Fx.IsFatal(e))
                        {
                            throw;
                        }

                        completeSelf        = true;
                        completionException = e;
                    }
                }

                if (completeSelf)
                {
                    thisPtr.Cleanup(completionException == null, asyncException == null);
                    thisPtr.Complete(false, completionException);
                }
            }