Skip to content

System.Net.Internals.SocketExceptionFactory+ExtendedSocketException #37150

@akalnay

Description

@akalnay

For the code below I was expecting to get a System.Net.Sockets.SocketException, however for a .NET Core 2.2 project it throws a System.Net.Internals.SocketExceptionFactory+ExtendedSocketException:

    class Program
    {
        static async Task Main()
        {
            Console.WindowWidth = 132;
            try
            {
                await ConnectClientAsync();
            }
            catch (Exception e)
            {
                Console.WriteLine($"Caught exception {e.GetType()}.{Environment.NewLine}{e.Message}.");
            }
            Console.WriteLine("Press any key to end.");
            Console.ReadKey();
        }

        private static async Task ConnectClientAsync()
        {
            TcpClient tcpClient = new TcpClient();
            await tcpClient.ConnectAsync(IPAddress.Loopback, 54321).ConfigureAwait(false);
        }
    }

For a .NET Framework 4.7.2 project the same code throws the expected System.Net.Sockets.SocketException.

This issue appears to be similar to 20744, 29081, 30073.

Metadata

Metadata

Assignees

Labels

area-System.Net.SocketsenhancementProduct code improvement that does NOT require public API changes/additions

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions