Description
BCL Dns class APIS doesn't seem to be able to resolve IPv6 even for basic well-known host names
Reproduction Steps
using System.Net;
var addrs = Dns.GetHostAddresses("google.com");
foreach (var addr in addrs)
{
Console.WriteLine(addr);
}
Expected behavior
Same address list as I get via Resolve-DnsName powershell command:
2a00:1450:4025:800::65
2a00:1450:4025:800::8a
2a00:1450:4025:800::71
2a00:1450:4025:800::66
142.250.109.102
142.250.109.100
142.250.109.113
142.250.109.138
142.250.109.139
142.250.109.101
Actual behavior
Program prints only IPv4 addresses:
142.250.120.102
142.250.120.113
142.250.120.139
142.250.120.100
142.250.120.138
142.250.120.101
Regression?
Same behavior on .NET Framework 4.8.1, .NET 8, 10 and 11
Known Workarounds
I don't think there are any. When I specify AddressFamily.InterNetworkV6 as the second parameter of Dns.GetHostAddresses I get System.Net.Sockets.SocketException (0x00002AFC) thrown
Configuration
.NET Framework 4.8.1, .NET 8, 10 and 11
Windows 11 25H2 (26200.8457) x64, didn't check on other OSes
Other information
No response
Description
BCL
Dnsclass APIS doesn't seem to be able to resolve IPv6 even for basic well-known host namesReproduction Steps
Expected behavior
Same address list as I get via
Resolve-DnsNamepowershell command:Actual behavior
Program prints only IPv4 addresses:
Regression?
Same behavior on .NET Framework 4.8.1, .NET 8, 10 and 11
Known Workarounds
I don't think there are any. When I specify
AddressFamily.InterNetworkV6as the second parameter ofDns.GetHostAddressesI getSystem.Net.Sockets.SocketException (0x00002AFC)thrownConfiguration
.NET Framework 4.8.1, .NET 8, 10 and 11
Windows 11 25H2 (26200.8457) x64, didn't check on other OSes
Other information
No response