56 instantiations of SocketException
dotnet-svcutil-lib (2)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\CoreClrSocketConnection.cs (2)
486throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SocketException((int)_asyncWriteEventArgs.SocketError)); 725throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SocketException((int)_asyncReadEventArgs.SocketError));
System.Net.NameResolution (2)
System\Net\Dns.cs (2)
480exception = new SocketException((int)SocketError.HostNotFound); 984new SocketException((int)error) { HResult = nativeError };
System.Net.Ping (1)
src\runtime\src\libraries\Common\src\System\Net\IPEndPointExtensions.cs (1)
29throw new SocketException((int)SocketError.AddressFamilyNotSupported);
System.Net.Primitives (4)
src\runtime\src\libraries\Common\src\System\Net\IPEndPointExtensions.cs (1)
29throw new SocketException((int)SocketError.AddressFamilyNotSupported);
System\Net\IPAddress.cs (2)
773private void ThrowSocketOperationNotSupported() => throw new SocketException(SocketError.OperationNotSupported, SR.Format(SR.net_SocketException_OperationNotSupported, AddressFamily)); 776private static void ThrowSocketOperationNotSupportedReadOnly() => throw new SocketException(SocketError.OperationNotSupported, SR.net_SocketException_OperationNotSupported_ReadOnlyIPAddress);
System\Net\IPAddressParser.cs (1)
59throw new FormatException(SR.dns_bad_ip_address, new SocketException(SocketError.InvalidArgument));
System.Net.Quic (6)
src\runtime\src\libraries\Common\src\System\Net\IPEndPointExtensions.cs (1)
29throw new SocketException((int)SocketError.AddressFamilyNotSupported);
System\Net\Quic\Internal\ThrowHelper.cs (4)
83if (status == QUIC_STATUS_INVALID_ADDRESS) return new SocketException((int)SocketError.AddressNotAvailable); 84if (status == QUIC_STATUS_ADDRESS_IN_USE) return new SocketException((int)SocketError.AddressAlreadyInUse); 85if (status == QUIC_STATUS_UNREACHABLE) return new SocketException((int)SocketError.HostUnreachable); 86if (status == QUIC_STATUS_ADDRESS_NOT_AVAILABLE) return new SocketException((int)SocketError.AddressFamilyNotSupported);
System\Net\Quic\QuicConnection.cs (1)
401throw new SocketException((int)SocketError.HostNotFound);
System.Net.Sockets (39)
src\runtime\src\libraries\Common\src\System\Net\IPEndPointExtensions.cs (1)
29throw new SocketException((int)SocketError.AddressFamilyNotSupported);
src\runtime\src\libraries\Common\src\System\Net\Sockets\SocketExceptionFactory.Unix.cs (1)
18return new SocketException(socketError, CreateMessage(nativeErr, endPoint));
System\Net\Sockets\Socket.cs (19)
92throw new SocketException((int)errorCode); 1132throw new SocketException((int)errorCode); 1161if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, new SocketException((int)errorCode)); 1183throw new SocketException((int)errorCode); 1209if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, new SocketException((int)errorCode)); 1236throw new SocketException((int)errorCode); 1254if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, new SocketException((int)errorCode)); 1535throw new SocketException((int)errorCode); 1558if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, new SocketException((int)errorCode)); 1581throw new SocketException((int)errorCode); 1599if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, new SocketException((int)errorCode)); 1626throw new SocketException((int)errorCode); 1656if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(this, new SocketException((int)errorCode)); 1840socketException = new SocketException((int)errorCode); 1964socketException = new SocketException((int)errorCode); 2040SocketException socketException = new SocketException((int)errorCode); 2424throw new SocketException((int)errorCode); 3924var socketException = new SocketException((int)error); 4050throw new SocketException((int)SocketError.IsConnected);
System\Net\Sockets\Socket.Tasks.cs (3)
162throw new SocketException((int)SocketError.IsConnected); 903Exception e = ExceptionDispatchInfo.SetCurrentStackTrace(new SocketException((int)error)); 1370Exception e = new SocketException((int)error);
System\Net\Sockets\Socket.Unix.cs (4)
73throw new SocketException((int)SocketError.NotSocket); 81throw new SocketException((int)SocketError.NotSocket); 127throw new SocketException((int)errorCode); 177throw new SocketException((int)SocketError.InvalidArgument);
System\Net\Sockets\SocketAsyncContext.Unix.cs (1)
1367throw new SocketException((int)SocketPal.GetSocketErrorForErrorCode(Interop.Sys.GetLastError()));
System\Net\Sockets\SocketAsyncEventArgs.cs (2)
835caughtException = new SocketException((int)lastError); 840caughtException = new SocketException((int)SocketError.OperationAborted);
System\Net\Sockets\SocketPal.Unix.cs (4)
2123throw new SocketException((int)error); 2134throw new SocketException((int)error); 2180throw new SocketException((int)GetSocketErrorForErrorCode(err)); 2194throw new SocketException((int)errorCode);
System\Net\Sockets\UDPClient.cs (4)
432throw new SocketException((int)SocketError.OperationNotSupported); 452throw new SocketException((int)SocketError.OperationNotSupported); 520throw new SocketException((int)SocketError.OperationNotSupported); 800throw new SocketException((int)SocketError.NotConnected);
System.ServiceModel.NetTcp (1)
System\ServiceModel\Channels\SocketAwaitableEventArgs.cs (1)
103return new SocketException((int)e);
System.ServiceModel.UnixDomainSocket (1)
System\ServiceModel\Channels\SocketAwaitableEventArgs.cs (1)
103return new SocketException((int)e);
164 references to SocketException
aspire (8)
Backchannel\AppHostCliBackchannel.cs (1)
377catch (SocketException) when (DateTime.UtcNow - startTime < maxWait)
Backchannel\AuxiliaryBackchannelMonitor.cs (1)
355catch (SocketException ex) when (ex.SocketErrorCode == SocketError.ConnectionRefused)
Backchannel\ExtensionBackchannel.cs (1)
119catch (SocketException ex)
DotNet\DotNetCliRunner.cs (2)
177catch (SocketException ex) when (execution is not null && execution.HasExited && execution.ExitCode != 0) 185catch (SocketException ex)
Projects\AppHostRpcClient.cs (1)
140catch (SocketException)
Projects\GuestAppHostProject.cs (2)
962catch (SocketException ex) when (process.HasExited && process.ExitCode != 0) 969catch (SocketException)
Aspire.Dashboard.Tests (2)
Integration\ServerRetryHelper.cs (2)
171catch (SocketException ex) when (ex.SocketErrorCode == SocketError.AddressAlreadyInUse) 176catch (SocketException ex)
Aspire.Hosting (1)
Backchannel\AuxiliaryBackchannelService.cs (1)
177catch (IOException ex) when (ex.InnerException is SocketException { SocketErrorCode: SocketError.ConnectionReset })
Aspire.Hosting.Tests (1)
Helpers\Network.cs (1)
36ShouldHandle = new PredicateBuilder<int>().Handle<SocketException>(),
Aspire.RabbitMQ.Client (1)
src\Components\Aspire.RabbitMQ.Client\AspireRabbitMQExtensions.cs (1)
193ShouldHandle = static args => args.Outcome is { Exception: SocketException or BrokerUnreachableException }
dotnet-svcutil-lib (21)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\CoreClrSocketConnection.cs (7)
348catch (SocketException socketException) 400catch (SocketException socketException) 462catch (SocketException socketException) 543catch (SocketException socketException) 586catch (SocketException socketException) 662catch (SocketException socketException) 702catch (SocketException socketException)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\DnsCache.cs (3)
63catch (SocketException) 105SocketException dnsException = null; 110catch (SocketException e)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\SocketConnection.cs (11)
170protected Exception ConvertSendException(SocketException socketException, TimeSpan remainingTime) 176protected Exception ConvertReceiveException(SocketException socketException, TimeSpan remainingTime) 182internal static Exception ConvertTransferException(SocketException socketException, TimeSpan timeout, Exception originalException) 204private static Exception ConvertTransferException(SocketException socketException, TimeSpan timeout, Exception originalException, 435public static Exception ConvertConnectException(SocketException socketException, Uri remoteUri, TimeSpan timeSpent, Exception innerException) 497catch (SocketException socketException) 513SocketException innerException) 540SocketException lastException = null; 564catch (SocketException socketException) 592SocketException lastException = null; 616catch (SocketException socketException)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (1)
Internal\QuicConnectionListener.cs (1)
134catch (SocketException e) when (e.SocketErrorCode == SocketError.AddressAlreadyInUse)
Microsoft.Diagnostics.NETCore.Client (2)
DiagnosticsIpc\IpcTransport.cs (2)
94catch (SocketException ex) 132catch (SocketException ex)
Microsoft.DotNet.HotReload.Watch (2)
src\sdk\src\Dotnet.Watch\AspireService\Helpers\SocketUtilities.cs (1)
80catch (SocketException)
src\sdk\src\Dotnet.Watch\HotReloadClient\NamedPipeClientTransport.cs (1)
62return e is ObjectDisposedException or EndOfStreamException or SocketException { ErrorCode: 125 }
Microsoft.Extensions.Diagnostics.ExceptionSummarization (3)
ExceptionSummarizationBuilderExtensions.cs (1)
17/// Registers a summary provider that handles <see cref="OperationCanceledException"/>, <see cref="WebException"/>, and <see cref="SocketException"/> .
HttpExceptionSummaryProvider.cs (2)
77typeof(SocketException), 104case SocketException ex:
Microsoft.Extensions.Diagnostics.Probes (1)
TcpEndpointProbesService.cs (1)
57catch (SocketException ex)
Microsoft.Extensions.Diagnostics.Probes.Tests (1)
TcpEndpointProbesServiceTests.cs (1)
107catch (SocketException e)
Microsoft.Extensions.ServiceDiscovery.Dns (1)
Resolver\DnsResolver.cs (1)
386catch (SocketException ex)
Microsoft.NET.Build.Containers (1)
AuthHandshakeMessageHandler.cs (1)
616catch (HttpRequestException e) when (e.InnerException is IOException ioe && ioe.InnerException is SocketException se)
Microsoft.TestPlatform.CommunicationUtilities (4)
SocketCommunicationManager.cs (1)
375if (ioException.InnerException is SocketException socketException
SocketServer.cs (1)
75catch (SocketException ex)
TcpClientExtensions.cs (2)
37catch (SocketException socketException) 72if (ioException.InnerException is SocketException socketException
netstandard (1)
netstandard.cs (1)
1272[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Sockets.SocketException))]
NuGet.Protocol (3)
Providers\ServiceIndexResourceV3Provider.cs (1)
175ex.InnerException.InnerException is System.Net.Sockets.SocketException)
RemoteRepositories\HttpFileSystemBasedFindPackageByIdResource.cs (1)
557ex.InnerException.InnerException is System.Net.Sockets.SocketException)
Utility\FindPackagesByIdNupkgDownloader.cs (1)
307ex.InnerException.InnerException is System.Net.Sockets.SocketException)
System (1)
src\runtime\src\libraries\shims\System\ref\System.cs (1)
762[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Sockets.SocketException))]
System.IO.Pipes (7)
System\IO\Pipes\NamedPipeClientStream.Unix.cs (1)
46catch (SocketException e)
System\IO\Pipes\NamedPipeServerStream.Unix.cs (1)
349catch (SocketException) when (isFirstPipeInstance && !isSocketBound)
System\IO\Pipes\PipeStream.Unix.cs (5)
274catch (SocketException e) 297catch (SocketException e) 309catch (SocketException e) 326catch (SocketException e) 332private IOException GetIOExceptionForSocketException(SocketException e)
System.Net (1)
System.Net.cs (1)
43[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Sockets.SocketException))]
System.Net.Http (2)
System\Net\Http\SocketsHttpHandler\ConnectHelper.cs (1)
156if (exception is SocketException socketException &&
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (1)
153catch (Exception e) when (e is SocketException || e is ObjectDisposedException)
System.Net.HttpListener (3)
System\Net\Managed\HttpEndPointManager.cs (1)
159catch (SocketException ex)
System\Net\ServiceNameStore.cs (2)
284catch (System.Net.Sockets.SocketException) 302catch (System.Net.Sockets.SocketException)
System.Net.NameResolution (12)
System\Net\Dns.cs (11)
135if (ex is SocketException soex) 331catch (SocketException ex) 361catch (SocketException ex) 474private static bool TryHandleRfc6761InvalidDomain(string hostName, out SocketException? exception) 502if (TryHandleRfc6761InvalidDomain(hostName, out SocketException? invalidDomainException)) 561catch (SocketException ex) when (addressFamily == AddressFamily.InterNetworkV6 && ex.SocketErrorCode == SocketError.HostNotFound) 707if (TryHandleRfc6761InvalidDomain(hostName, out SocketException? invalidDomainException)) 825catch (SocketException ex) when (isLocalhostSubdomain && !fallbackOccurred) 858catch (SocketException ex) when (family == AddressFamily.InterNetworkV6 && ex.SocketErrorCode == SocketError.HostNotFound) 871catch (SocketException ex) when (family == AddressFamily.InterNetworkV6 && ex.SocketErrorCode == SocketError.HostNotFound) 983private static SocketException CreateException(SocketError error, int nativeError) =>
System\Net\NameResolutionTelemetry.cs (1)
145internal static string GetErrorType(Exception exception) => (exception as SocketException)?.SocketErrorCode switch
System.Net.NetworkInformation (1)
System\Net\NetworkInformation\NetworkAddressChange.Unix.cs (1)
208catch (SocketException se) when (se.SocketErrorCode == SocketError.OperationAborted)
System.Net.Ping (6)
System\Net\NetworkInformation\Ping.RawSocket.cs (6)
281catch (SocketException ex) when (ex.SocketErrorCode == SocketError.TimedOut) 284catch (SocketException ex) when (ex.SocketErrorCode == SocketError.MessageSize) 288catch (SocketException ex) when (ex.SocketErrorCode == SocketError.HostUnreachable) 366catch (SocketException ex) when (ex.SocketErrorCode == SocketError.TimedOut) 369catch (SocketException ex) when (ex.SocketErrorCode == SocketError.MessageSize) 376catch (SocketException ex) when (ex.SocketErrorCode == SocketError.HostUnreachable)
System.Net.Primitives (5)
System\Net\SocketException.cs (4)
18/// <summary>Creates a new instance of the <see cref='System.Net.Sockets.SocketException'/> class with the specified error code.</summary> 33/// <summary>Initializes a new instance of the <see cref='System.Net.Sockets.SocketException'/> class with the specified error code and optional message.</summary> 38/// <summary>Creates a new instance of the <see cref='System.Net.Sockets.SocketException'/> class with the specified error code as SocketError.</summary> 44/// <summary>Initializes a new instance of the <see cref='System.Net.Sockets.SocketException'/> class with the specified error code as SocketError and optional message.</summary>
System\Net\SocketException.Unix.cs (1)
10/// <summary>Creates a new instance of the <see cref='System.Net.Sockets.SocketException'/> class with the default error code.</summary>
System.Net.Requests (5)
System\Net\FtpWebRequest.cs (3)
917ioEx.InnerException is SocketException sEx && 935if (e is SocketException se) 1005if (!(exception is SocketException || exception is ObjectDisposedException) || !timer.HasExpired)
System\Net\WebException.cs (2)
105SocketException? socketException = ex.InnerException as SocketException;
System.Net.Sockets (39)
src\runtime\src\libraries\Common\src\System\Net\Sockets\SocketExceptionFactory.Unix.cs (1)
8public static SocketException CreateSocketException(int socketError, EndPoint endPoint)
System\Net\Sockets\Socket.cs (22)
107/// <exception cref="SocketException"><paramref name="handle"/> is not a socket or information about the socket could not be accessed.</exception> 1293/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 1321/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 1414/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 1431/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 1474/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 1837SocketException? socketException = null; 1920/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 1935/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 1961SocketException? socketException = null; 2018/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 2040SocketException socketException = new SocketException((int)errorCode); 2168/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 2288/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 2346/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 2381/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 2393/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 2436/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 3383SocketException socketException = SocketExceptionFactory.CreateSocketException((int)errorCode, endPointSnapshot); 3924var socketException = new SocketException((int)error); 3933internal void UpdateStatusAfterSocketError(SocketException socketException, bool disconnectOnFailure = true) 4083SocketException se => se.SocketErrorCode,
System\Net\Sockets\Socket.Tasks.cs (2)
710/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception> 728/// <exception cref="SocketException">An error occurred when attempting to access the socket.</exception>
System\Net\Sockets\Socket.Unix.cs (1)
284catch (TargetInvocationException ex) when (ex.InnerException is SocketException se && se.SocketErrorCode == SocketError.OperationNotSupported)
System\Net\Sockets\SocketAsyncEventArgs.cs (3)
451SocketException? socketException = exception as SocketException; 879(caughtException is SocketException se && se.SocketErrorCode == SocketError.OperationAborted))
System\Net\Sockets\SocketPal.Unix.cs (1)
2146exc is SocketException se ? se.SocketErrorCode :
System\Net\Sockets\TCPListener.cs (2)
149catch (SocketException) 296catch (SocketException) when (!_active)
System\Net\Sockets\UDPClient.cs (7)
543/// <exception cref="SocketException">An error occurred when accessing the socket.</exception> 568/// <exception cref="SocketException">An error occurred when accessing the socket.</exception> 602/// <exception cref="SocketException">An error occurred when accessing the socket.</exception> 645/// <exception cref="SocketException">An error occurred when accessing the socket.</exception> 894/// <exception cref="SocketException">An error occurred when accessing the socket.</exception> 935/// <exception cref="SocketException">An error occurred when accessing the socket.</exception> 964/// <exception cref="SocketException">An error occurred when accessing the socket.</exception>
System.ServiceModel.Http (2)
System\ServiceModel\Channels\HttpChannelHelpers.cs (2)
122var innerSocketException = exception.InnerException as SocketException;
System.ServiceModel.NetTcp (15)
System\ServiceModel\Channels\DnsCache.cs (3)
42catch (SocketException) 84SocketException dnsException = null; 89catch (SocketException e)
System\ServiceModel\Channels\SocketAwaitableEventArgs.cs (1)
101protected static SocketException CreateException(SocketError e)
System\ServiceModel\Channels\SocketConnection.cs (11)
219catch (SocketException socketException) 301catch (SocketException socketException) 410catch (SocketException socketException) 669private Exception ConvertSendException(SocketException socketException, TimeSpan remainingTime, TimeSpan timeout) 675private Exception ConvertReceiveException(SocketException socketException, TimeSpan remainingTime, TimeSpan timeout) 681private static Exception ConvertTransferException(SocketException socketException, TimeSpan timeout, Exception originalException, 825public static Exception ConvertConnectException(SocketException socketException, Uri remoteUri, TimeSpan timeSpent, Exception innerException) 899catch (SocketException socketException) 915SocketException innerException) 942SocketException lastException = null; 965catch (SocketException socketException)
System.ServiceModel.UnixDomainSocket (11)
System\ServiceModel\Channels\SocketAwaitableEventArgs.cs (1)
101protected static SocketException CreateException(SocketError e)
System\ServiceModel\Channels\SocketConnection.cs (10)
201catch (SocketException socketException) 280catch (SocketException socketException) 389catch (SocketException socketException) 633private Exception ConvertSendException(SocketException socketException, TimeSpan remainingTime, TimeSpan timeout) 639private Exception ConvertReceiveException(SocketException socketException, TimeSpan remainingTime, TimeSpan timeout) 645private static Exception ConvertTransferException(SocketException socketException, TimeSpan timeout, Exception originalException, 790public static Exception ConvertConnectException(SocketException socketException, Uri remoteUri, TimeSpan timeSpent, Exception innerException) 837private static TimeoutException CreateTimeoutException(Uri uri, TimeSpan timeout, SocketException innerException) 845SocketException lastException = null; 858catch (SocketException socketException)