System.Net.Http.WinHttpHandler.WinHttpHandler.InternalSendRequestAsync C# (CSharp) Method

InternalSendRequestAsync() private method

private InternalSendRequestAsync ( WinHttpRequestState state ) : RendezvousAwaitable
state WinHttpRequestState
return RendezvousAwaitable
        private RendezvousAwaitable<int> InternalSendRequestAsync(WinHttpRequestState state)
        {
            lock (state.Lock)
            {
                state.Pin();
                if (!Interop.WinHttp.WinHttpSendRequest(
                    state.RequestHandle,
                    null,
                    0,
                    IntPtr.Zero,
                    0,
                    0,
                    state.ToIntPtr()))
                {
                    // Dispose (which will unpin) the state object. Since this failed, WinHTTP won't associate
                    // our context value (state object) to the request handle. And thus we won't get HANDLE_CLOSING
                    // notifications which would normally cause the state object to be unpinned and disposed.
                    state.Dispose();
                    WinHttpException.ThrowExceptionUsingLastError();
                }
            }

            return state.LifecycleAwaitable;
        }