Repository: dotnet/runtime
File: src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/StringParsingHelpers.Connections.cs (C#)

Code before:
                    skip++;
                }
            }

            if (skip != 0)
            {
                Array.Resize(ref endPoints, endPoints.Length - skip);
            }

            return endPoints;
        }

        public static IPEndPoint[] ParseActiveUdpListenersFromFiles(string udp4File, string udp6File)
        {
            if (!File.Exists(udp4File) || !File.Exists(udp6File))
            {
                throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
            }

            string udp4FileContents = File.ReadAllText(udp4File);
            string[] v4connections = udp4FileContents.Split(s_newLineSeparator, StringSplitOptions.RemoveEmptyEntries);

            string udp6FileContents = File.ReadAllText(udp6File);
            string[] v6connections = udp6FileContents.Split(s_newLineSeparator, StringSplitOptions.RemoveEmptyEntries);

            // First line is header in each file. on WSL, this file may be empty
            int count = 0;
            if (v4connections.Length > 0)
            {
                count += v4connections.Length - 1;
            }

            if (v6connections.Length > 0)
            {
                count += v6connections.Length - 1;
            }

            IPEndPoint[] endPoints = new IPEndPoint[count];
            int index = 0;

            // UDP Connections
            for (int i = 1; i < v4connections.Length; i++) // Skip first line header.
            {
                string line = v4connections[i];
                IPEndPoint endPoint = ParseLocalConnectionInformation(line);
                endPoints[index++] = endPoint;
            }

            // UDP6 Connections
            for (int i = 1; i < v6connections.Length; i++) // Skip first line header.
            {

Review comment (suggestion):
```suggestion
            // First line is header in each file. On WSL, this file may be empty.
```

Code after:
                    skip++;
                }
            }

            if (skip != 0)
            {
                Array.Resize(ref endPoints, endPoints.Length - skip);
            }

            return endPoints;
        }

        public static IPEndPoint[] ParseActiveUdpListenersFromFiles(string udp4File, string udp6File)
        {
            if (!File.Exists(udp4File) || !File.Exists(udp6File))
            {
                throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
            }

            string udp4FileContents = File.ReadAllText(udp4File);
            string[] v4connections = udp4FileContents.Split(s_newLineSeparator, StringSplitOptions.RemoveEmptyEntries);

            string udp6FileContents = File.ReadAllText(udp6File);
            string[] v6connections = udp6FileContents.Split(s_newLineSeparator, StringSplitOptions.RemoveEmptyEntries);

            // First line is header in each file. On WSL, this file may be empty.
            int count = 0;
            if (v4connections.Length > 0)
            {
                count += v4connections.Length - 1;
            }

            if (v6connections.Length > 0)
            {
                count += v6connections.Length - 1;
            }

            IPEndPoint[] endPoints = new IPEndPoint[count];
            int index = 0;

            // UDP Connections
            for (int i = 1; i < v4connections.Length; i++) // Skip first line header.
            {
                string line = v4connections[i];
                IPEndPoint endPoint = ParseLocalConnectionInformation(line);
                endPoints[index++] = endPoint;
            }

            // UDP6 Connections
            for (int i = 1; i < v6connections.Length; i++) // Skip first line header.
            {