public static unsafe Task?GetAddrInfoAsync(string hostName, bool justAddresses, AddressFamily addressFamily, CancellationToken _)
        {
            Debug.Assert(hostName is not null);

            if (hostName.Length == 0)
            {
                // To match documented behavior on Windows, if an empty string is passed in, use the local host's name.
                hostName = Dns.GetHostName();
            }

            GetHostEntryForNameContext *context = GetHostEntryForNameContext.AllocateContext();

            GetHostEntryForNameState state;

            try
            {
                state          = new GetHostEntryForNameState(hostName, justAddresses);
                context->State = state.CreateHandle();
            }
            catch
            {
                GetHostEntryForNameContext.FreeContext(context);
                throw;
            }

            int errorCode = Interop.Sys.GetHostEntryForNameAsync(hostName, addressFamily, &context->Result, &GetHostEntryForNameCallback);

            if (errorCode != 0)
            {
                ProcessResult(GetSocketErrorForNativeError(errorCode), context);
            }

            return(state.Task);
        }
        private static unsafe void ProcessResult(SocketError errorCode, GetHostEntryForNameContext *context)
        {
            try
            {
                GetHostEntryForNameState state = GetHostEntryForNameState.FromHandleAndFree(context->State);

                if (errorCode == SocketError.Success)
                {
                    ParseHostEntry(context->Result, state.JustAddresses, out string?hostName, out string[] aliases, out IPAddress[] addresses);