3

My Xamarin app uses an external IP Address when communicating with a back-end web service. With Xamarin.iOS 9.6.2.4, the call is successful. After upgrading to Xamarin.iOS 9.8.0.323, I am now hitting an exception with message "Error:NameResolutionFailure."

If I switch to using the internal IP address or FQDN, the call is successful.

Does this appear to be a bug in the latest Xamarin update, or should something be changed in the way that the request is being made?

try
{
  //Exception message - Error:NameResolutionFailure
  string url = "http://[External-IP-Address]:8081/MyWebService/api/GetByID/1";

  //The following two URLs are successful
  //string url = "http://[Internal-IP-Address]:8081/MyWebService/api/GetByID/1";
  //string url = "http://[Fully-Qualified-Domain-Name]:8081/MyWebService/api/GetByID/1";

  HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(new Uri(url));
  request.ContentType = "application/json";
  request.Method = "GET";
  request.Timeout = 10 * 60 * 1000;

  using (WebResponse response = await request.GetResponseAsync())
  {
    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
    {
      string jsonData = reader.ReadToEnd();
    }
  }
}
catch (Exception e)
{
  Console.WriteLine(e.Message);
}

Exception Stack Trace

at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x0005e] in /Users/builder/data/lanes/3339/39ebb778/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System/System.Net/HttpWebRequest.cs:1005 
at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (IAsyncResult iar, System.Func`2 endFunction, System.Action`1 endAction, System.Threading.Tasks.Task`1 promise, Boolean requiresSynchronization) [0x00014] in /Users/builder/data/lanes/3339/39ebb778/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/threading/Tasks/FutureFactory.cs:550 
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3339/39ebb778/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/3339/39ebb778/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3339/39ebb778/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3339/39ebb778/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/3339/39ebb778/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357 
at TestURL.ViewController+<ViewDidLoad>c__async0.MoveNext () [0x000b0] in /Users/Administrator/Projects/TestURL/TestURL/ViewController.cs:26 

Additional Information:

  • Running on iPhone 6s simulator (iOS 9.3)
jkh
  • 3,380
  • 8
  • 33
  • 58
  • Hey! Just to confirm it is indeed a bug (it really appears as such, but I want to confirm) are you able to install the previous stable using this link: https://store.xamarin.com/account/my/subscription/downloads#cycle6 and test? Thanks! – cobey Jun 17 '16 at 15:53
  • @clb Yes, after downgrading to Xamarin.iOS 9.6.2.4, the request completes successfully again. – jkh Jun 17 '16 at 15:57
  • Okay! Would you be willing to provide a copy of the application so that I can file it with the Xamarin engineers as a private bug? Only people who work within Xamarin will have access to it. – cobey Jun 17 '16 at 15:58
  • Yes, I can provide the sample application that demonstrates the error. Should I fill out the bug report at https://bugzilla.xamarin.com/newbug?release=C7 (I'm not sure where I would provide the copy of the application though). – jkh Jun 17 '16 at 16:08
  • Generally I suggest uploading it to Dropbox and linking it on the bug. If you paste the link to the bug (make sure it is marked as private) I can escalate within Xamarin and follow up. – cobey Jun 17 '16 at 16:11
  • @clb https://bugzilla.xamarin.com/show_bug.cgi?id=41938 – jkh Jun 17 '16 at 16:31
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/114966/discussion-between-jkh-and-clb). – jkh Jun 17 '16 at 16:35

1 Answers1

4

After some research, this is a known issue with the Cycle 7 baseline release. We are tracking this on the following public bug: https://bugzilla.xamarin.com/show_bug.cgi?id=41782

At this time, the best option would be to stay on Cycle 6 or (if possible) use the fully qualified domain name.

Thanks!

cobey
  • 1,191
  • 8
  • 21