GetHostAddresses() on MacOS
Description
Hi, GetHostAddresses() is supposed to return the addresses for the "local/default hostname" when it is passed the null string ("").
However, it is currently returning the following exception on MacOS:
---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000005, 0xFFFDFFFF): nodename nor servname provided, or not known
Note, the GetHostAddress() page clearly states:
https://learn.microsoft.com/en-us/dotnet/api/system.net.dns.gethostaddresses?view=net-8.0
"If an empty string is passed as the hostNameOrAddress argument, then this method returns the IPv4 and IPv6 addresses of the local host."
Based on the issue below, this could be an environmental issue...though still a bug/regression:
https://github.com/dotnet/runtime/issues/29780
Looks like DNS lookups on MacOS are buggy (multiple issues).
Reproduction Steps
Call Dns.GetHostAddresses("");
Expected behavior
Return the IP addresses associated with the local/default hostname.
Actual behavior
---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000005, 0xFFFDFFFF): nodename nor servname provided, or not known
Regression?
Yes
Known Workarounds
We are trying Dns.GetHostAddresses(Dns.GetHostName));
Configuration
.NET 8
Still retrieving the MacOS version.
Other information
No response
Tagging subscribers to this area: @dotnet/ncl See info in area-owners.md if you want to be subscribed.
Issue Details
Description
Hi, GetHostAddresses() is supposed to return the addresses for the "local/default hostname" when it is passed the null string ("").
However, it is currently return the following exception on MacOS:
---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000005, 0xFFFDFFFF): nodename nor servname provided, or not known
Note, the GetHostAddress() page clearly states:
https://learn.microsoft.com/en-us/dotnet/api/system.net.dns.gethostaddresses?view=net-8.0
Based on the issue below, this could be an environmental issue...though still a bug/regression:
https://github.com/dotnet/runtime/issues/29780
Looks like DNS lookups on MacOS are buggy (multiple issues).
Reproduction Steps
Call Dns.GetHostAddresses("");
Expected behavior
Return the IP addresses associated with the local/default hostname.
Actual behavior
---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000005, 0xFFFDFFFF): nodename nor servname provided, or not known
Regression?
Yes
Known Workarounds
We are trying Dns.GetHostAddresses(Dns.GetHostName));
Configuration
.NET 8
Still retrieving the MacOS version.
Other information
No response
| Author: | ScotMac |
|---|---|
| Assignees: | - |
| Labels: |
|
| Milestone: | - |
This turned out to be an environmental issue.