private static IPHostEntry HostResolutionEndHelper(IAsyncResult asyncResult)
{
//
// parameter validation
//
if (asyncResult == null)
{
throw new ArgumentNullException(nameof(asyncResult));
}
ResolveAsyncResult castedResult = asyncResult as ResolveAsyncResult;
if (castedResult == null)
{
throw new ArgumentException(SR.net_io_invalidasyncresult, nameof(asyncResult));
}
if (castedResult.EndCalled)
{
throw new InvalidOperationException(SR.Format(SR.net_io_invalidendcall, nameof(EndResolve)));
}
if (NetEventSource.IsEnabled) NetEventSource.Info(null);
castedResult.InternalWaitForCompletion();
castedResult.EndCalled = true;
Exception exception = castedResult.Result as Exception;
if (exception != null)
{
throw exception;
}
return (IPHostEntry)castedResult.Result;
}