117 instantiations of HttpRequestException
aspire (2)
Commands\TelemetryCommandHelpers.cs (2)
156throw new HttpRequestException( 166throw new HttpRequestException(
Aspire.Cli.Tests (12)
Commands\TelemetryCommandTests.cs (3)
345throw new HttpRequestException("Connection refused"); 355throw new HttpRequestException("Connection refused"); 449using var handler = new MockHttpMessageHandler(new HttpRequestException("Connection refused"));
Commands\TelemetryLogsCommandTests.cs (2)
424throw new HttpRequestException("Connection refused"); 454throw new HttpRequestException("Connection refused");
Mcp\Docs\DocsFetcherTests.cs (2)
195using var handler = new MockHttpMessageHandler(new HttpRequestException("Network error")); 383using var handler = new MockHttpMessageHandler(new HttpRequestException("Network error"));
Mcp\Docs\DocsIndexServiceTests.cs (1)
805var fetcher = new ThrowingDocsFetcher(new HttpRequestException("Network error"));
ProfileCaptureServiceTests.cs (4)
200throw new HttpRequestException("not ready"); 225throw new HttpRequestException("connection refused"); 245new MockHttpMessageHandler(new HttpRequestException("not ready")), 264throw new HttpRequestException("not ready");
Aspire.Hosting.Azure (1)
AcrLoginService.cs (1)
175throw new HttpRequestException(
Aspire.Hosting.Azure.Tests (6)
AcrLoginServiceTests.cs (1)
22throw new HttpRequestException("Name or service not known");
AzureSandboxesTests.cs (5)
1315? Task.FromException<HttpResponseMessage>(new HttpRequestException("connection reset")) 1336return Task.FromException<HttpResponseMessage>(new HttpRequestException("connection reset")); 2875throw new HttpRequestException("connection reset"); 2920new HttpRequestException("create response lost"), 3004private readonly Exception _portRemovalException = portRemovalException ?? new HttpRequestException("port removal failed");
Aspire.Hosting.Tests (3)
Health\FriendlyHealthCheckErrorMessagesTests.cs (3)
166var exception = new HttpRequestException(); 179var exception = new HttpRequestException(); 214var exception = new HttpRequestException(null, null, System.Net.HttpStatusCode.NotFound);
Microsoft.AspNetCore.Authentication.Facebook (1)
FacebookHandler.cs (1)
55throw new HttpRequestException($"An error occurred when retrieving Facebook user information ({response.StatusCode}). Please check if the authentication information is correct and the corresponding Facebook Graph API is enabled.");
Microsoft.AspNetCore.Authentication.Google (1)
GoogleHandler.cs (1)
53throw new HttpRequestException($"An error occurred when retrieving Google user information ({response.StatusCode}). Please check if the authentication information is correct.");
Microsoft.AspNetCore.Authentication.MicrosoftAccount (1)
MicrosoftAccountHandler.cs (1)
49throw new HttpRequestException($"An error occurred when retrieving Microsoft user information ({response.StatusCode}). Please check if the authentication information is correct and the corresponding Microsoft Account API is enabled.");
Microsoft.AspNetCore.Server.Kestrel.Core (1)
src\aspnetcore\src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (1)
403throw new HttpRequestException(SR.net_http_request_invalid_char_encoding);
Microsoft.AspNetCore.SpaServices.Extensions (1)
Proxying\SpaProxy.cs (1)
120throw new HttpRequestException(
Microsoft.Extensions.Http.Diagnostics.Tests (2)
Logging\HttpClientLoggerTest.cs (1)
82var exception = new HttpRequestException();
Logging\HttpClientLoggingExtensionsTest.cs (1)
696: throw new HttpRequestException("Simulated failure");
Microsoft.Extensions.Http.Resilience.Tests (6)
Hedging\HedgingTests.cs (1)
355throw new HttpRequestException("Something went wrong!");
Hedging\HttpClientHedgingResiliencePredicatesTests.cs (2)
22Assert.True(HttpClientHedgingResiliencePredicates.IsTransientHttpException(new HttpRequestException())); 31Assert.True(HttpClientHedgingResiliencePredicates.IsTransient(Outcome.FromException<HttpResponseMessage>(new HttpRequestException())));
Polly\HttpCircuitBreakerStrategyOptionsTests.cs (1)
23new object[] { new HttpRequestException(), true },
Polly\HttpClientResiliencePredicatesTests.cs (1)
20new object[] { new HttpRequestException(), true },
Polly\HttpRetryStrategyOptionsTests.cs (1)
25[new HttpRequestException(), null!, true],
System.Net.Http (78)
src\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\HPackEncoder.cs (1)
403throw new HttpRequestException(SR.net_http_request_invalid_char_encoding);
System\Net\Http\HttpContent.cs (3)
235throw new HttpRequestException(SR.net_http_content_read_as_stream_has_task); 708return ExceptionDispatchInfo.SetCurrentStackTrace(new HttpRequestException(error, SR.net_http_content_stream_copy_error, e)); 780return (HttpRequestException)ExceptionDispatchInfo.SetCurrentStackTrace(new HttpRequestException(HttpRequestError.ConfigurationLimitExceeded, SR.Format(CultureInfo.InvariantCulture, SR.net_http_content_buffersize_exceeded, maxBufferSize)));
System\Net\Http\HttpResponseMessage.cs (1)
165throw new HttpRequestException(
System\Net\Http\SocketsHttpHandler\AuthenticationHelper.NtAuth.cs (1)
184throw new HttpRequestException(HttpRequestError.UserAuthenticationError, SR.Format(SR.net_http_authvalidationfailure, statusCode), statusCode: HttpStatusCode.Unauthorized);
System\Net\Http\SocketsHttpHandler\ConnectHelper.cs (2)
92HttpRequestException ex = new HttpRequestException(HttpRequestError.SecureConnectionError, SR.net_http_ssl_connection_failed, e); 143new HttpRequestException(DeduceError(exception), $"{exception.Message} ({host}:{port})", exception, RequestRetryType.RetryOnNextProxy);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.cs (8)
478HttpRequestException exception = new(HttpRequestError.ExtendedConnectNotSupported, SR.net_unsupported_extended_connect); 545throw new HttpRequestException(HttpRequestError.VersionNegotiationError, SR.Format(SR.net_http_requested_version_server_refused, request.Version, request.VersionPolicy), e); 697stream = await streamTask.ConfigureAwait(false) ?? throw new HttpRequestException(SR.net_http_null_from_connect_callback); 786throw new HttpRequestException(SR.net_http_exception_during_plaintext_filter, e); 792throw new HttpRequestException(SR.net_http_null_from_plaintext_filter); 814throw new HttpRequestException(HttpRequestError.ProxyTunnelError, SR.Format(SR.net_http_proxy_tunnel_returned_failure_status_code, _proxyUri, (int)tunnelResponse.StatusCode), statusCode: tunnelResponse.StatusCode); 841throw new HttpRequestException(HttpRequestError.ProxyTunnelError, SR.net_http_proxy_tunnel_error, e); 888HttpRequestException ex = new(HttpRequestError.VersionNegotiationError, SR.Format(SR.net_http_requested_version_cannot_establish, request.Version, request.VersionPolicy, desiredVersion), inner);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http2.cs (3)
209connectionException = new HttpRequestException(SR.Format(SR.net_ssl_http2_requires_tls12, sslStream.SslProtocol)); 273throw new HttpRequestException(SR.net_http_client_execution_error, e); 497HttpRequestException hre = new HttpRequestException(SR.net_http_http2_connection_not_established);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http3.cs (1)
275throw new HttpRequestException(HttpRequestError.ConnectionError, "QUIC connected but no HTTP/3 indicated via ALPN.", null, RequestRetryType.RetryOnConnectionFailure);
System\Net\Http\SocketsHttpHandler\ContentLengthWriteStream.cs (3)
29throw new HttpRequestException(SR.net_http_content_write_larger_than_content_length); 43return ValueTask.FromException(ExceptionDispatchInfo.SetCurrentStackTrace(new HttpRequestException(SR.net_http_content_write_larger_than_content_length))); 55return Task.FromException(ExceptionDispatchInfo.SetCurrentStackTrace(new HttpRequestException(SR.Format(SR.net_http_request_content_length_mismatch, BytesWritten, _contentLength))));
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (5)
1641throw new HttpRequestException(SR.Format(SR.net_http_request_headers_exceeded_length, maxHeaderListSize)); 2171throw new HttpRequestException(HttpRequestError.UserAuthenticationError, SR.net_http_authconnectionfailure, null, RequestRetryType.RetryOnSessionAuthenticationChallenge); 2179throw new HttpRequestException(e.HttpRequestError, e.Message, e); 2183throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_client_execution_error, e); 2285throw new HttpRequestException((innerException as HttpIOException)?.HttpRequestError ?? HttpRequestError.Unknown, message, innerException, RequestRetryType.RetryOnConnectionFailure);
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (10)
232throw new HttpRequestException(SR.Format(SR.net_http_request_content_length_mismatch, writeStream.BytesWritten, writeStream.ContentLength)); 560throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response); 583throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response); 609throw new HttpRequestException(HttpRequestError.ConfigurationLimitExceeded, SR.Format(SR.net_http_response_headers_exceeded_length, _connection._pool.Settings.MaxResponseHeadersByteLength)); 631throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response_multiple_status_codes); 638throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response_pseudo_header_in_trailer); 701throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response); 745throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response); 754throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_header_name, Encoding.ASCII.GetString(name))); 1537return ValueTask.FromException(ExceptionDispatchInfo.SetCurrentStackTrace(new HttpRequestException(SR.net_http_content_write_larger_than_content_length)));
System\Net\Http\SocketsHttpHandler\Http3Connection.cs (3)
318throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_request_aborted, null, RequestRetryType.RetryOnConnectionFailure); 331throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_request_aborted, null, RequestRetryType.RetryOnConnectionFailure); 349throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_client_execution_error, _abortException, RequestRetryType.RetryOnConnectionFailure);
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (18)
300throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_retry_on_older_version, ex, RequestRetryType.RetryOnLowerHttpVersion); 305throw new HttpRequestException(HttpRequestError.HttpProtocolError, SR.net_http_request_aborted, rejectedException, RequestRetryType.RetryOnConnectionFailure); 311throw new HttpRequestException(httpRequestError, SR.net_http_client_execution_error, innerException); 321throw new HttpRequestException(HttpRequestError.HttpProtocolError, SR.net_http_client_execution_error, abortException); 336throw new HttpRequestException(httpRequestError, SR.net_http_client_execution_error, _connection.AbortException); 342throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_http3_connection_quic_error, ex); 356throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_request_aborted, ex, RequestRetryType.RetryOnConnectionFailure); 362throw new HttpRequestException(ex.HttpRequestError, SR.net_http_client_execution_error, ex); 367throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response, ex); 372throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_client_execution_error, ex); 384throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_client_execution_error, ex); 496throw new HttpRequestException(SR.Format(SR.net_http_request_content_length_mismatch, sent, contentLength)); 547throw new HttpRequestException(SR.net_http_content_write_larger_than_content_length); 764throw new HttpRequestException(SR.Format(SR.net_http_request_headers_exceeded_length, maxHeaderListSize)); 997throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_header_name, Encoding.ASCII.GetString(name))); 1039throw new HttpRequestException(HttpRequestError.ConfigurationLimitExceeded, SR.Format(SR.net_http_response_headers_exceeded_length, _connection.Pool.Settings.MaxResponseHeadersByteLength)); 1363throw new HttpRequestException(httpRequestError, SR.net_http_client_execution_error, _connection.AbortException); 1382throw new HttpIOException(HttpRequestError.Unknown, SR.net_http_client_execution_error, new HttpRequestException(SR.net_http_client_execution_error, ex));
System\Net\Http\SocketsHttpHandler\HttpAuthority.cs (1)
46throw new HttpRequestException(SR.net_http_request_invalid_host_punycode);
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (16)
323throw new HttpRequestException(SR.net_http_request_no_host); 530throw new HttpRequestException(SR.net_http_request_invalid_char_encoding); 929mappedException = new HttpRequestException(SR.net_http_client_execution_error, exception); 938mappedException = new HttpRequestException(error, SR.net_http_client_execution_error, ioe, _canRetry ? RequestRetryType.RetryOnConnectionFailure : RequestRetryType.NoRetry); 1070throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_status_line, Encoding.ASCII.GetString(line))); 1091throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_status_line, Encoding.ASCII.GetString(line))); 1099throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_status_code, Encoding.ASCII.GetString(line.Slice(9, 3)))); 1124throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_status_reason, Encoding.ASCII.GetString(reasonBytes.ToArray())), formatEx); 1130throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_status_line, Encoding.ASCII.GetString(line))); 1229throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_header_line, Encoding.ASCII.GetString(buffer.Slice(0, newLineIndex)))); 1328throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_header_name, "")); 1331throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_header_name, Encoding.ASCII.GetString(name))); 1335throw new HttpRequestException(HttpRequestError.ConfigurationLimitExceeded, SR.Format(SR.net_http_response_headers_exceeded_length, _pool.Settings.MaxResponseHeadersByteLength)); 1645throw new HttpRequestException(SR.net_http_chunk_too_large); 2106throw new HttpRequestException(HttpRequestError.UserAuthenticationError, SR.net_http_authconnectionfailure); 2122throw new HttpRequestException(HttpRequestError.UserAuthenticationError, SR.net_http_authconnectionfailure);
System\Net\Http\SocketsHttpHandler\HttpConnectionBase.cs (1)
306throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_status_code, Encoding.ASCII.GetString(value)));
System\Net\Http\SocketsHttpHandler\SocketsHttpHandler.cs (1)
720return ExceptionDispatchInfo.SetCurrentStackTrace(new HttpRequestException(SR.net_http_client_execution_error,
System.Net.Http.Json (1)
System\Net\Http\Json\LengthLimitReadStream.cs (1)
33throw new HttpRequestException(SR.Format(SR.net_http_content_buffersize_exceeded, limit));
System.Net.Http.WinHttpHandler (1)
System\Net\Http\WinHttpHandler.cs (1)
1571state.Tcs.TrySetException(new HttpRequestException(SR.net_http_client_execution_error, ex));
135 references to HttpRequestException
aspire (20)
Agents\AspireSkills\AspireSkillsInstaller.cs (1)
278catch (Exception ex) when (ex is HttpRequestException or HttpIOException or JsonException)
Agents\AspireSkills\GitHubArtifactAttestationVerifier.cs (1)
58catch (HttpRequestException ex)
Commands\ExportCommand.cs (1)
120catch (HttpRequestException ex) when (dashboardUrl is not null)
Commands\TelemetryCommandHelpers.cs (6)
142/// an <see cref="HttpRequestException"/> with a <see cref="HttpStatusCode.NotFound"/> status code 145/// <exception cref="HttpRequestException"> 342HttpRequestException ex, 361HttpRequestException ex, 415HttpRequestException ex, 456catch (HttpRequestException ex)
Commands\TelemetryLogsCommand.cs (1)
157catch (HttpRequestException ex)
Commands\TelemetrySpansCommand.cs (1)
149catch (HttpRequestException ex)
Commands\TelemetryTracesCommand.cs (1)
107catch (HttpRequestException ex)
Mcp\Tools\ListStructuredLogsTool.cs (1)
135catch (HttpRequestException ex)
Mcp\Tools\ListTracesTool.cs (1)
135catch (HttpRequestException ex)
Mcp\Tools\ListTraceStructuredLogsTool.cs (1)
125catch (HttpRequestException ex)
Npm\SigstoreNpmProvenanceChecker.cs (1)
168catch (HttpRequestException ex)
Profiling\ProfileCaptureService.cs (1)
301catch (HttpRequestException)
Telemetry\InternalMicrosoftDetector.cs (2)
663catch (Exception ex) when (ex is HttpRequestException or JsonException or InvalidOperationException or TaskCanceledException) 685catch (Exception ex) when (ex is OperationCanceledException or TimeoutException or HttpRequestException or JsonException or InvalidOperationException or TaskCanceledException)
Utils\EnvironmentChecker\DcpConnectionChecker.cs (1)
110catch (HttpRequestException ex)
Aspire.Cli.EndToEnd.Tests (2)
Helpers\CliE2ETestHelpers.cs (2)
683catch (Exception ex) when (ex is HttpRequestException or TaskCanceledException or IOException) 770catch (Exception ex) when (ex is HttpRequestException or TaskCanceledException or IOException)
Aspire.Cli.Tests (3)
Mcp\Docs\DocsIndexServiceTests.cs (1)
808await Assert.ThrowsAsync<HttpRequestException>(() => service.SearchAsync("Redis").AsTask());
ProfileCaptureServiceTests.cs (2)
424var exception = await Assert.ThrowsAsync<HttpRequestException>(() => session.ExportAsync(CancellationToken.None));
Aspire.Hosting (4)
Dcp\KubernetesService.cs (2)
513private static bool RetryOnConnectivityErrors(Exception ex) => ex is HttpRequestException || ex is KubeConfigException; 515ex is HttpRequestException ||
ExternalServiceBuilderExtensions.cs (2)
328HttpRequestException hre when hre.StatusCode.HasValue => 330HttpRequestException => $"Failed to connect to {sanitizedUri}",
Aspire.Hosting.Azure (3)
AcrLoginService.cs (3)
102catch (HttpRequestException ex) when (ShouldRetryAcrLoginFailure(ex, attempt, retryStartTimestamp)) 118private bool ShouldRetryAcrLoginFailure(HttpRequestException ex, int attempt, long retryStartTimestamp) 125private static bool IsRetryableAcrLoginFailure(HttpRequestException ex)
Aspire.Hosting.Azure.Sandboxes (4)
AzureSandboxContainerDeployment.cs (1)
2166catch (HttpRequestException ex)
Internal\Adc\AzureDevComputeClient.cs (3)
238catch (HttpRequestException ex) 283catch (Exception ex) when (ex is JsonException or InvalidOperationException or HttpRequestException or IOException or NotSupportedException) 316catch (HttpRequestException ex) when (attempt < MaxRetryCount && CanRetryAfterNetworkFailure(method))
Aspire.Hosting.Azure.Tests (13)
AcrLoginServiceTests.cs (3)
63await Assert.ThrowsAsync<HttpRequestException>(() => service.LoginAsync("registry.azurecr.io", "tenant", new StaticTokenCredential())); 85await Assert.ThrowsAsync<HttpRequestException>(() => service.LoginAsync("registry.azurecr.io", "tenant", new StaticTokenCredential())); 110await Assert.ThrowsAsync<HttpRequestException>(() => service.LoginAsync("registry.azurecr.io", "tenant", new StaticTokenCredential()));
AzureCosmosDBEmulatorFunctionalTests.cs (2)
76ShouldHandle = new PredicateBuilder().Handle<HttpRequestException>() 148ShouldHandle = new PredicateBuilder().Handle<HttpRequestException>()
AzureSandboxesTests.cs (8)
973var exception = await Assert.ThrowsAsync<HttpRequestException>(() => 1011var exception = await Assert.ThrowsAsync<HttpRequestException>(() => 1351Assert.IsType<HttpRequestException>(exception.OriginalException); 1474Assert.IsType<HttpRequestException>(exception.OriginalException); 2806var exception = await Assert.ThrowsAsync<HttpRequestException>(() =>
Aspire.Hosting.Browsers (1)
BrowserEndpointDiscovery.cs (1)
122catch (Exception ex) when (!cancellationToken.IsCancellationRequested && ex is HttpRequestException or IOException or JsonException or OperationCanceledException)
Aspire.Hosting.Browsers.Tests (1)
src\Aspire.Hosting.Browsers\BrowserEndpointDiscovery.cs (1)
122catch (Exception ex) when (!cancellationToken.IsCancellationRequested && ex is HttpRequestException or IOException or JsonException or OperationCanceledException)
Aspire.Hosting.Tests (3)
Health\FriendlyHealthCheckErrorMessagesTests.cs (3)
166var exception = new HttpRequestException(); 179var exception = new HttpRequestException(); 214var exception = new HttpRequestException(null, null, System.Net.HttpStatusCode.NotFound);
Aspire.Seq (1)
SeqHealthCheck.cs (1)
39catch (HttpRequestException hre)
dotnet (2)
Commands\Sdk\Check\ProductCollectionProvider.cs (2)
33catch (Exception ex) when (ex is HttpRequestException || 36(aggregateEx.InnerException is HttpRequestException ||
dotnet-aot (3)
src\sdk\src\Cli\dotnet\Commands\Sdk\Check\ProductCollectionProvider.cs (2)
33catch (Exception ex) when (ex is HttpRequestException || 36(aggregateEx.InnerException is HttpRequestException ||
src\sdk\src\Cli\dotnet\NugetSearch\NugetToolSearchApiRequest.cs (1)
105catch (Exception e) when (e is HttpRequestException or OperationCanceledException)
dotnet-openapi (1)
Commands\BaseCommand.cs (1)
329if (exception is HttpRequestException || exception is WebException)
dotnet-svcutil-lib (3)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpChannelFactory.cs (1)
945catch (HttpRequestException requestException)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpChannelHelpers.cs (2)
112public static HttpResponseMessage ProcessGetResponseWebException(HttpRequestException requestException, HttpRequestMessage request, HttpAbortReason abortReason) 126public static Exception ConvertHttpRequestException(HttpRequestException exception, HttpRequestMessage request, HttpAbortReason abortReason)
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (4)
Logging\AcceptanceTests.cs (4)
693var ex = await Assert.ThrowsAsync<HttpRequestException>(() => client.PutAsync("/error?body=true", content)); 727var ex = await Assert.ThrowsAsync<HttpRequestException>(() => client.PutAsync("/error?body=true", content));
Microsoft.AspNetCore.Server.IntegrationTesting (1)
Common\RetryHelper.cs (1)
56if (exception is HttpRequestException || exception is WebException)
Microsoft.AspNetCore.SpaProxy (2)
SpaProxyLaunchManager.cs (2)
85catch (Exception exception) when (exception is HttpRequestException || 116catch (Exception exception) when (exception is HttpRequestException ||
Microsoft.AspNetCore.SpaServices.Extensions (1)
Proxying\SpaProxy.cs (1)
118catch (HttpRequestException ex)
Microsoft.Build.Tasks.Core (2)
DownloadFile.cs (2)
164catch (HttpRequestException) 255if (actualException is HttpRequestException httpRequestException)
Microsoft.DotNet.Arcade.Sdk (1)
src\DownloadFile.cs (1)
205catch (Exception e) when (e is HttpRequestException ||
Microsoft.Extensions.Http (4)
Logging\LoggingHttpMessageHandler.cs (1)
76catch (HttpRequestException ex)
Logging\LoggingScopeHttpMessageHandler.cs (1)
76catch (HttpRequestException ex)
Logging\LogHelper.cs (2)
102public static void LogRequestFailed(this ILogger logger, TimeSpan duration, HttpRequestException exception) => 141public static void LogRequestPipelineFailed(this ILogger logger, TimeSpan duration, HttpRequestException exception) =>
Microsoft.Extensions.Http.Diagnostics.Tests (5)
Logging\HttpClientLoggerTest.cs (3)
82var exception = new HttpRequestException(); 110var actualException = await Assert.ThrowsAsync<HttpRequestException>(act);
Logging\HttpClientLoggingExtensionsTest.cs (2)
753HttpRequestException? lastException = null; 761catch (HttpRequestException ex)
Microsoft.Extensions.Http.Polly (1)
DependencyInjection\PollyHttpClientBuilderExtensions.cs (1)
203/// <item><description>Network failures (as <see cref="HttpRequestException"/>)</description></item>
Microsoft.Extensions.Http.Resilience (4)
Hedging\HttpHedgingStrategyOptions.cs (1)
23/// as well as <see cref="HttpRequestException"/>, <see cref="BrokenCircuitException"/>, and <see cref="TimeoutRejectedException"/> exceptions.
Polly\HttpCircuitBreakerStrategyOptions.cs (1)
20/// that is, timeouts, 5xx responses, and <see cref="HttpRequestException"/> exceptions.
Polly\HttpClientResiliencePredicates.cs (1)
50return exception is HttpRequestException or TimeoutRejectedException;
Polly\HttpRetryStrategyOptions.cs (1)
25/// as well as <see cref="HttpRequestException"/> and <see cref="TimeoutRejectedException"/> exceptions.
Microsoft.Extensions.Http.Resilience.PerformanceTests (2)
RetryBenchmark.cs (1)
48var builder = Policy.Handle<HttpRequestException>().Or<TimeoutRejectedException>().OrResult<HttpResponseMessage>(r =>
StandardResilienceBenchmark.cs (1)
43var builder = Policy.Handle<HttpRequestException>().Or<TimeoutRejectedException>().OrResult<HttpResponseMessage>(r =>
Microsoft.Extensions.Http.Resilience.Tests (2)
Hedging\HedgingTests.cs (2)
173var exception = await Assert.ThrowsAsync<HttpRequestException>(
Microsoft.ML.TestFrameworkCommon (1)
TestDownloadUtils.cs (1)
59retryWhen: ex => ex is HttpRequestException || ex is OperationCanceledException || ex is IOException);
Microsoft.NET.Build.Containers (4)
AmazonECRMessageHandler.cs (1)
26catch (HttpRequestException e) when (e.InnerException is IOException ioe && ioe.Message.Equals("The response ended prematurely.", StringComparison.OrdinalIgnoreCase))
AuthHandshakeMessageHandler.cs (1)
616catch (HttpRequestException e) when (e.InnerException is IOException ioe && ioe.InnerException is SocketException se)
FallbackToHttpMessageHandler.cs (2)
50catch (HttpRequestException re) when (canFallback && ShouldAttemptFallbackToHttp(re)) 77internal static bool ShouldAttemptFallbackToHttp(HttpRequestException exception)
Microsoft.NET.Sdk.Publish.Tasks (2)
Tasks\OneDeploy\OneDeployStatusService.cs (1)
77else if (ex is HttpRequestException)
Tasks\ZipDeploy\ZipDeploymentStatus.cs (1)
63catch (HttpRequestException)
netstandard (1)
netstandard.cs (1)
1130[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Http.HttpRequestException))]
NuGet.PackageManagement (2)
Resolution\ResolverGather.cs (2)
469catch (Exception ex) when (ex is System.Net.Http.HttpRequestException || ex is OperationCanceledException || ex is TaskCanceledException) 661catch (Exception ex) when (ex is System.Net.Http.HttpRequestException || ex is OperationCanceledException ||
NuGet.Protocol (3)
Resources\PackageSearchResourceV3.cs (1)
176catch (HttpRequestException ex)
Resources\PackageUpdateResource.cs (1)
950catch (HttpRequestException ex)
Resources\RawSearchResourceV3.cs (1)
99catch (HttpRequestException ex)
System.Net.Http (23)
System\Net\Http\DiagnosticsHelper.cs (1)
76errorType = (exception as HttpRequestException)?.HttpRequestError switch
System\Net\Http\HttpClient.cs (1)
631else if (e is HttpRequestException && cts.IsCancellationRequested) // if cancellationToken is canceled, cts will also be canceled
System\Net\Http\HttpContent.cs (2)
778private static HttpRequestException CreateOverCapacityException(long maxBufferSize) 780return (HttpRequestException)ExceptionDispatchInfo.SetCurrentStackTrace(new HttpRequestException(HttpRequestError.ConfigurationLimitExceeded, SR.Format(CultureInfo.InvariantCulture, SR.net_http_content_buffersize_exceeded, maxBufferSize)));
System\Net\Http\HttpProtocolException.cs (1)
14/// <see cref="HttpRequestException"/> if a protocol error occurs.
System\Net\Http\HttpRequestError.cs (1)
7/// Defines error categories representing the reason for <see cref="HttpRequestException"/> or <see cref="HttpIOException"/>.
System\Net\Http\HttpRequestException.cs (2)
27/// Initializes a new instance of the <see cref="HttpRequestException" /> class with a specific message that describes the current exception, an inner exception, and an HTTP status code. 39/// Initializes a new instance of the <see cref="HttpRequestException" /> class with a specific message an inner exception, and an HTTP status code and an <see cref="HttpRequestError"/>.
System\Net\Http\HttpVersionPolicy.cs (2)
24/// Throwing <see cref="HttpRequestException" /> if a connection with higher or equal version cannot be established. 36/// Throwing <see cref="HttpRequestException" /> if a connection with the exact version cannot be established.
System\Net\Http\RequestRetryType.cs (1)
7/// Used with <see cref="HttpRequestException"/> to indicate if a request is safe to retry.
System\Net\Http\SocketsHttpHandler\ConnectHelper.cs (1)
92HttpRequestException ex = new HttpRequestException(HttpRequestError.SecureConnectionError, SR.net_http_ssl_connection_failed, e);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.cs (6)
478HttpRequestException exception = new(HttpRequestError.ExtendedConnectNotSupported, SR.net_unsupported_extended_connect); 517catch (HttpRequestException e) when (e.AllowRetry == RequestRetryType.RetryOnConnectionFailure) 540catch (HttpRequestException e) when (e.AllowRetry == RequestRetryType.RetryOnLowerHttpVersion) 556catch (HttpRequestException e) when (e.AllowRetry == RequestRetryType.RetryOnSessionAuthenticationChallenge) 840Debug.Assert(e is not HttpRequestException); 888HttpRequestException ex = new(HttpRequestError.VersionNegotiationError, SR.Format(SR.net_http_requested_version_cannot_establish, request.Version, request.VersionPolicy, desiredVersion), inner);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http2.cs (1)
497HttpRequestException hre = new HttpRequestException(SR.net_http_http2_connection_not_established);
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (2)
377if (ex is HttpRequestException) 516catch (HttpRequestException hex) when (hex.InnerException is QuicException qex && qex.QuicError == QuicError.StreamAborted && qex.ApplicationErrorCode == (long)Http3ErrorCode.NoError)
System\Net\Http\SocketsHttpHandler\HttpConnectionPoolManager.cs (2)
464HttpRequestException rethrowException; 477catch (HttpRequestException ex) when (ex.AllowRetry != RequestRetryType.NoRetry)
System.Net.Requests (3)
System\Net\WebException.cs (2)
83if (exception is HttpRequestException hre) 103private static WebExceptionStatus GetStatusFromExceptionHelper(HttpRequestException ex)
System\Net\WebExceptionPal.Unix.cs (1)
10internal static WebExceptionStatus GetStatusFromException(HttpRequestException ex)
System.ServiceModel.Http (3)
System\ServiceModel\Channels\HttpChannelFactory.cs (1)
1065catch (HttpRequestException requestException)
System\ServiceModel\Channels\HttpChannelHelpers.cs (2)
103public static HttpResponseMessage ProcessGetResponseWebException(HttpRequestException requestException, HttpRequestMessage request, HttpAbortReason abortReason) 117public static Exception ConvertHttpRequestException(HttpRequestException exception, HttpRequestMessage request, HttpAbortReason abortReason)