Bug 29279 - Dns.GetHostEntry no longer returns hostname
Summary: Dns.GetHostEntry no longer returns hostname
Status: Tracked in Related Links
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: 4.0.0
Hardware: Macintosh Mac OS
: High normal
Target Milestone: Untriaged
Assignee: Bugzilla
: 56295 56299 ()
Depends on:
Reported: 2015-04-21 16:26 UTC by matt
Modified: 2018-07-03 09:19 UTC (History)
12 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 29279 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Tracked in Related Links

Description matt 2015-04-21 16:26:02 UTC
With mono 4.0 the reverse DNS broke. 
The following code always returns the IP address as string rather than the HostName.
Dns.GetHostEntry("my ip address").HostName

// IP for google.com
var google = Dns.GetHostEntry("");
Console.WriteLine("Hostname: " + google.HostName);
// outputs: "" instead of "google.com"

(This is with the mono 4.0 beta update. I didn't see the 4.0 version when filing this bug so hopefully someone can correct the ticket)
Comment 1 Cody Beyer (MSFT) 2015-05-15 20:36:24 UTC
Updating with test project

### Description

The following app demonstrates an issue within Mono 4, where the DNS.GetHostEntry method returns an incorrect result

### Test Case


### Steps to Reproduce

1. Open test case
2. Run with Mono

### Expected Results

A hostname should be returned

### Actual Results

The IP address is returned. 

### Working Version

Do the above with either mono 3.x or on Windows using CSC/.Net

### Versions

=== Xamarin Studio ===

Version 5.9.2 (build 0)
Installation UUID: 061f61cf-c366-4da7-b3c9-31033d0fc883
	Mono 4.0.1 ((detached/6d5afc1)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400010034

=== Apple Developer Tools ===

Xcode 6.3.1 (7703)
Build 6D1002

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: b39367d
Branch: master
Build date: 2015-05-14 08:50:11-0400

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/beyerc/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: (Business Edition)

=== Build Information ===

Release ID: 509020000
Git revision: f97f3598952edca4678fc9fdafffecb68ed24399
Build date: 2015-05-08 11:55:56-04
Xamarin addins: ab18ddff45f507ed74f36c2b65df9aee22e28a56

=== Operating System ===

Mac OS X 10.10.3
Darwin Codys-MBP.router 14.3.0 Darwin Kernel Version 14.3.0
    Mon Mar 23 11:59:05 PDT 2015
    root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
Comment 2 matt 2015-08-11 13:20:41 UTC
Is Xamarin bugzilla the most appropriate place for this ticket? Is there a higher likelihood of this getting fixed if reported elsewhere?
Comment 3 Konrad Mrożek 2015-09-18 09:11:38 UTC
It appears that the bug was introduced here:

Comment 4 Konrad Mrożek 2015-09-18 09:24:33 UTC
Ok. It is not the case :). Sorry :).
Comment 5 Anonymous 2016-01-12 14:34:21 UTC
Any idea when this will be fixed?
Comment 6 Brendan Zagaeski (Xamarin Team, assistant) 2017-06-05 18:52:53 UTC
*** Bug 56299 has been marked as a duplicate of this bug. ***
Comment 7 Brendan Zagaeski (Xamarin Team, assistant) 2017-06-05 18:53:37 UTC
*** Bug 56295 has been marked as a duplicate of this bug. ***
Comment 8 sam 2017-11-21 21:46:35 UTC
This is affecting me on Linux too. Currently standing in the way of an important ircd feature - reverse DNS lookups for blacklists (e.g. proxies). Version: mono

The same code works on Windows.