private static void WriteCallback(IAsyncResult transportResult)
{
if (!transportResult.CompletedSynchronously)
{
LazyAsyncResult asyncState = (LazyAsyncResult)transportResult.AsyncState;
try
{
NegoState asyncObject = (NegoState)asyncState.AsyncObject;
asyncObject._Framer.EndWriteMessage(transportResult);
if (asyncState.Result is Exception)
{
asyncObject._CanRetryAuthentication = true;
throw ((Exception)asyncState.Result);
}
asyncObject.CheckCompletionBeforeNextReceive(asyncState);
}
catch (Exception exception)
{
if (asyncState.InternalPeekCompleted)
{
throw;
}
asyncState.InvokeCallback(exception);
}
}
}