1 type derived from HttpRequestException
aspire (1)
Commands\TelemetryCommandHelpers.cs (1)
772: HttpRequestException(
136 instantiations of HttpRequestException
aspire (1)
Commands\TelemetryCommandHelpers.cs (1)
155throw new HttpRequestException(
Aspire.Cli.Tests (21)
Commands\TelemetryCommandTests.cs (8)
351throw new HttpRequestException( 398using var handler = new MockHttpMessageHandler(new HttpRequestException( 412new HttpRequestException( 448new HttpRequestException( 464using var handler = new MockHttpMessageHandler(new HttpRequestException( 543throw new HttpRequestException("Connection refused"); 553throw new HttpRequestException("Connection refused"); 665using var handler = new MockHttpMessageHandler(new HttpRequestException("Connection refused"));
Commands\TelemetryLogsCommandTests.cs (2)
429throw new HttpRequestException("Connection refused"); 459throw 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"));
Mcp\ListStructuredLogsToolTests.cs (1)
139throw new HttpRequestException(
Mcp\ListTracesToolTests.cs (1)
45throw new HttpRequestException(
Mcp\ListTraceStructuredLogsToolTests.cs (1)
39throw new HttpRequestException(
Mcp\McpToolHelpersTests.cs (1)
18var exception = new HttpRequestException(
ProfileCaptureServiceTests.cs (4)
264throw new HttpRequestException("not ready"); 289throw new HttpRequestException("connection refused"); 309new MockHttpMessageHandler(new HttpRequestException("not ready")), 328throw new HttpRequestException("not ready");
Aspire.Hosting.Azure (1)
AcrLoginService.cs (1)
175throw new HttpRequestException(
Aspire.Hosting.Azure.Tests (6)
AcrLoginServiceTests.cs (1)
61throw new HttpRequestException("Name or service not known");
AzureSandboxesTests.cs (5)
1401? Task.FromException<HttpResponseMessage>(new HttpRequestException("connection reset")) 1422return Task.FromException<HttpResponseMessage>(new HttpRequestException("connection reset")); 3457throw new HttpRequestException("connection reset"); 3502new HttpRequestException("create response lost"), 3586private readonly Exception _portRemovalException = portRemovalException ?? new HttpRequestException("port removal failed");
Aspire.Hosting.Native.Core.Tests (11)
DcpWorkloadCleanupTests.cs (8)
63? Task.FromException(new HttpRequestException("Transient failure")) 114? Task.FromException(new HttpRequestException("Transient failure")) 142throw new HttpRequestException("Transient failure"); 175? Task.FromException(new HttpRequestException("Transient failure")) 200? Task.FromException(new HttpRequestException("Transient failure")) 226? Task.FromException(new HttpRequestException("Command cleanup failure")) 229? Task.FromException(new HttpRequestException("Primary cleanup failure")) 282throw new HttpRequestException("Transient service failure");
NativeProviderLifecycleTests.cs (1)
24? Task.FromException(new HttpRequestException("Transient failure"))
NativeSocketIsolationTests.cs (2)
600 => (Exception)new HttpRequestException("secret-controller-token"), 125StartFailure = new HttpRequestException("secret-token-and-controller-address")
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)
698: 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));
158 references to HttpRequestException
aspire (23)
Agents\AspireSkills\AspireSkillsInstaller.cs (1)
278catch (Exception ex) when (ex is HttpRequestException or HttpIOException or JsonException)
Agents\AspireSkills\GitHubArtifactAttestationVerifier.cs (1)
61catch (HttpRequestException ex)
Commands\ExportCommand.cs (1)
120catch (HttpRequestException ex) when (dashboardUrl is not null)
Commands\TelemetryCommandHelpers.cs (7)
141/// an <see cref="HttpRequestException"/> with a <see cref="HttpStatusCode.NotFound"/> status code 144/// <exception cref="HttpRequestException"> 350HttpRequestException ex, 373HttpRequestException ex, 441HttpRequestException ex, 489catch (HttpRequestException ex) 507private static string GetBoundedHttpFailureReason(HttpRequestException exception)
Commands\TelemetryLogsCommand.cs (1)
157catch (HttpRequestException ex)
Commands\TelemetrySpansCommand.cs (1)
152catch (HttpRequestException ex)
Commands\TelemetryTracesCommand.cs (1)
108catch (HttpRequestException ex)
Mcp\Tools\ListStructuredLogsTool.cs (1)
136catch (HttpRequestException ex)
Mcp\Tools\ListTracesTool.cs (1)
136catch (HttpRequestException ex)
Mcp\Tools\ListTraceStructuredLogsTool.cs (1)
126catch (HttpRequestException ex)
Mcp\Tools\McpToolHelpers.cs (1)
146return exception is HttpRequestException { StatusCode: { } statusCode }
Npm\SigstoreNpmProvenanceChecker.cs (1)
169catch (HttpRequestException ex)
Profiling\ProfileCaptureService.cs (1)
304catch (HttpRequestException)
src\Shared\Telemetry\InternalMicrosoftDetector.cs (3)
435HttpRequestException => InternalMicrosoftProbeExceptionType.HttpRequest, 983catch (Exception ex) when (ex is HttpRequestException or JsonException or InvalidOperationException or TaskCanceledException) 1010catch (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)
712catch (Exception ex) when (ex is HttpRequestException or TaskCanceledException or IOException) 799catch (Exception ex) when (ex is HttpRequestException or TaskCanceledException or IOException)
Aspire.Cli.Tests (4)
Mcp\Docs\DocsIndexServiceTests.cs (1)
808await Assert.ThrowsAsync<HttpRequestException>(() => service.SearchAsync("Redis").AsTask());
Mcp\McpToolHelpersTests.cs (1)
18var exception = new HttpRequestException(
ProfileCaptureServiceTests.cs (2)
488var exception = await Assert.ThrowsAsync<HttpRequestException>(() => session.ExportAsync(CancellationToken.None));
Aspire.Dashboard (3)
src\Shared\Telemetry\InternalMicrosoftDetector.cs (3)
435HttpRequestException => InternalMicrosoftProbeExceptionType.HttpRequest, 983catch (Exception ex) when (ex is HttpRequestException or JsonException or InvalidOperationException or TaskCanceledException) 1010catch (Exception ex) when (ex is OperationCanceledException or TimeoutException or HttpRequestException or JsonException or InvalidOperationException or TaskCanceledException)
Aspire.Dashboard.Playwright.Tests (1)
Integration\Playwright\NativeAotDashboardTests.cs (1)
201catch (HttpRequestException)
Aspire.Deployment.EndToEnd.Tests (2)
AcaExpressDeploymentTests.cs (1)
376catch (HttpRequestException)
Helpers\DotnetProjectDeploymentHelpers.cs (1)
89catch (Exception ex) when (ex is HttpRequestException || ex is TaskCanceledException && !cancellationToken.IsCancellationRequested)
Aspire.Hosting (4)
Dcp\KubernetesService.cs (2)
613private static bool RetryOnConnectivityErrors(Exception ex) => ex is HttpRequestException || ex is KubeConfigException; 687ex 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 (3)
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)
102await Assert.ThrowsAsync<HttpRequestException>(() => service.LoginAsync("registry.azurecr.io", "tenant", new StaticTokenCredential())); 124await Assert.ThrowsAsync<HttpRequestException>(() => service.LoginAsync("registry.azurecr.io", "tenant", new StaticTokenCredential())); 149await 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)
1059var exception = await Assert.ThrowsAsync<HttpRequestException>(() => 1097var exception = await Assert.ThrowsAsync<HttpRequestException>(() => 1437Assert.IsType<HttpRequestException>(exception.OriginalException); 1560Assert.IsType<HttpRequestException>(exception.OriginalException); 3376var 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.Foundry (1)
FoundryLocalHealthCheck.cs (1)
44catch (HttpRequestException e)
Aspire.Hosting.JavaScript.Tests (1)
AddDenoAppTests.cs (1)
2766catch (Exception ex) when (ex is HttpRequestException or TaskCanceledException)
Aspire.Hosting.Native.Core.Tests (8)
DcpWorkloadCleanupTests.cs (4)
117await Assert.ThrowsAsync<HttpRequestException>(() => 184await Assert.ThrowsAsync<HttpRequestException>(() => runtime.ApplyRevision(revision.Seal())); 252await Assert.ThrowsAsync<HttpRequestException>(workload.StopAsync); 288await Assert.ThrowsAsync<HttpRequestException>(() => lease.DisposeAsync().AsTask());
NativeIpcSecurityTests.cs (1)
210catch (HttpRequestException)
NativeSocketIsolationTests.cs (2)
160value.ErrorType == typeof(HttpRequestException).FullName); 163value.GetTagItem("error.type") as string == typeof(HttpRequestException).FullName);
NativeSymbolicWorkloadSocketTests.cs (1)
133catch (HttpRequestException)
Aspire.Hosting.Native.Server (2)
Dashboard\DcpDashboard.cs (1)
87catch (HttpRequestException exception) when (exception.InnerException is
src\Shared\DcpConnectionMaterial.cs (1)
139!hasExited() && exception is HttpRequestException
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-aot (3)
parent\dotnet\Commands\Sdk\Check\ProductCollectionProvider.cs (2)
33catch (Exception ex) when (ex is HttpRequestException || 36(aggregateEx.InnerException is HttpRequestException ||
parent\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.AspNetCore.Watch.BrowserRefresh (1)
src\sdk\src\Dotnet.Watch\Web.Middleware\BrowserToolsForwarder.cs (1)
97catch (HttpRequestException exception)
Microsoft.Build.Tasks.Core (2)
DownloadFile.cs (2)
164catch (HttpRequestException) 255if (actualException is HttpRequestException httpRequestException)
Microsoft.DotNet.Arcade.Sdk (1)
src\DownloadFile.cs (1)
224catch (Exception e) when (e is HttpRequestException ||
Microsoft.DotNet.Cli.InternalMicrosoft (2)
Internal\InternalMicrosoftDetectionUtilities.cs (2)
158HttpRequestException => nameof(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)
861HttpRequestException? lastException = null; 869catch (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)
689catch (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.CommandLine.XPlat (1)
Commands\Package\Stage\StagePushCommandRunner.cs (1)
138catch (HttpRequestException ex)
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)
179catch (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)