internal static void AddExceptionRange(ref ConnectionReturnResult returnResult, HttpWebRequest [] requests, Exception exception, Exception firstRequestException)
{
//This may cause duplicate requests if we let it through in retail
if (exception == null)
throw new InternalException();
if (returnResult == null) {
returnResult = new ConnectionReturnResult(requests.Length);
}
// "abortedRequestExeption" is assigned to the "abortedRequest" or to the very first request if the latest is null
// Everyone else will get "exception"
for (int i = 0; i < requests.Length; ++i)
{
#if DEBUG
//This may cause duplicate requests if we let it through in retail but it's may be expensive to catch here
for (int j = 0; j < returnResult.m_Context.Count; ++j)
if ((object)returnResult.m_Context[j].Request == (object) requests[i])
throw new InternalException();
#endif
if (i == 0)
returnResult.m_Context.Add(new RequestContext(requests[i], firstRequestException));
else
returnResult.m_Context.Add(new RequestContext(requests[i], exception));
}
}