Bug 24242 - System.Net.Dns.GetHostEntry fails with SocketException on iOS devices running iOS 8.1
Summary: System.Net.Dns.GetHostEntry fails with SocketException on iOS devices running...
Status: RESOLVED INVALID
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 8.4.0
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-11-04 03:48 UTC by Prashant Cholachagudda
Modified: 2014-11-04 04:09 UTC (History)
1 user (show)

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


Attachments
Testcase (18.65 KB, application/zip)
2014-11-04 03:48 UTC, Prashant Cholachagudda
Details


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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description Prashant Cholachagudda 2014-11-04 03:48:22 UTC
Created attachment 8615 [details]
Testcase

This code below is failing with SocketException: could not resolve host "ip address" on iOS8.1 devices. The same code on iOS7.* devices work correctly on the same network with the same set up. 


public static string GetLocnCode()
{
var code = string.Empty;
try
{
var storeName = System.Net.Dns.GetHostEntry("ip address here");
//still very dodgy but hey.. Let's keep to tradition.l
code = storeName.HostName.Split('.')[0].Substring(1, 4);
}
catch (Exception ex)
{
Console.WriteLine("Unable to determine store code: {0}", ex);
}

return code;

}

The stack trace is as follows:

System.Net.Sockets.SocketException: Could not resolve host '172.17.38.188'
at System.Net.Dns.Error_11001 (System.String hostName) [0x00000] in <filename unknown>:0
at System.Net.Dns.hostent_to_IPHostEntry (System.String originalHostName, System.String h_name, System.String[] h_aliases, System.String[] h_addrlist) [0x00000] in <filename unknown>:0
at System.Net.Dns.GetHostByAddressFromString (System.String address, Boolean parse) [0x00000] in <filename unknown>:0
at System.Net.Dns.GetHostEntry (System.Net.IPAddress address) [0x00000] in <filename unknown>:0
at System.Net.Dns.GetHostEntry (System.String hostNameOrAddress) [0x00000] in <filename unknown>:0
at Common.IOS.Utilities.StoreIPHelper.GetLocnCode () [0x00000] in <filename unknown>:0
Comment 2 Prashant Cholachagudda 2014-11-04 04:09:58 UTC
The problem as with customer's server.
Their DHCP servers were issuing the wrong search domains.