Потому что внутри Dns.GetHostEntry
вызывается IPAddress.TryParse
. И он успешно парсит строку 3410890
, как IP и => вся последующая работа этого метода неверная, так как пытается достучаться по несуществующему IP.
В MSDN написано, что это баг, но его правка нарушит работу существующих приложений:
Note that this method accepts as valid an ipString value that can be
parsed as an Int64, and then treats that Int64 as the long value of an
IP address in network byte order, similar to the way that the
IPAddress constructor does. This means that this method returns true
if the Int64 is parsed successfully, even if it represents an address
that's not a valid IP address. For example, if ipString is "1", this
method returns true even though "1" (or 0.0.0.1) is not a valid IP
address and you might expect this method to return false. Fixing this
bug would break existing apps, so the current behavior will not be
changed. Your code can avoid this behavior by ensuring that it only
uses this method to parse IP addresses in dotted-decimal format.
Возможно в .NET CORE его пофиксили, так как перед ними не ставилась задача обратной совместимости.
Что бы этого не было используйте другую перегрузку и в ручную передавайте созданный вами собственноручно объектIPAddress
.