Bug 53220 - NSUrlSessionHandler failing after update to Xamarin 6.2
Summary: NSUrlSessionHandler failing after update to Xamarin 6.2
Status: RESOLVED DUPLICATE of bug 52682
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 10.4 (C9)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-03-10 12:22 UTC by tmrog
Modified: 2017-03-16 13:01 UTC (History)
3 users (show)

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


Attachments
Test Project that also fails (3.09 MB, application/zip)
2017-03-13 18:45 UTC, tmrog
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 DUPLICATE of bug 52682

Description tmrog 2017-03-10 12:22:30 UTC
After updating to Xamarin 6.2, my app can no longer communicate with my web service.

I am connecting to a web service via a local network IP address (10.35.32.237:65453) with HTTP scheme.

I am explicitly providing NSUrlSessionHandler to my HttpClient.

I have NSAppTransportSecurity with NSAllowLocalNetworking to YES.

I am seeing two symptoms:

1. The web service does not receive my post body
2. The request times out

I wrote a Swift app that does the same operation using NSUrlSession and it worked with no problem.

Thread I started on forums: https://forums.xamarin.com/discussion/89357/nsurlsessionhandler-failing-after-update-to-xamarin-6-2

Ted
Comment 1 Vincent Dondain [MSFT] 2017-03-10 22:13:42 UTC
Hi,

Is there any chance you can share a test case with us so we can reproduce the issue and double check your project configuration?

If you have sensitive information I can make this entire bug private.

Also please give us your entire environment information:

Xamarin Studio > About > Show details
Comment 2 tmrog 2017-03-13 17:23:22 UTC
I'll see if I can put a test project together but even if I do you won't be able to reproduce unless you can setup a similar endpoint. Anyway, I should have something sometime today I hope.

=== Xamarin Studio Community ===

Version 6.2 (build 1821)
Installation UUID: 3fc30716-ec05-46b4-b28e-a8439c1a2729
Runtime:
	Mono 4.8.0 (mono-4.8.0-branch/e4a3cf3) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 408000495

=== NuGet ===

Version: 3.5.0.0

=== Xamarin.Profiler ===

Version: 1.2.0
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.2 (11766)
Build 8C38

=== Xamarin.Android ===

Version: 7.1.0.41 (Xamarin Studio Community)
Android SDK: /Users/trs2/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		6.0 (API level 23)

SDK Tools Version: 25.1.2
SDK Platform Tools Version: 24.0.0
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Not Installed

=== Xamarin.Mac ===

Version: 3.0.0.393 (Xamarin Studio Community)

=== Xamarin.iOS ===

Version: 10.4.0.123 (Xamarin Studio Community)
Hash: 35d1ccd
Branch: cycle9
Build date: 2017-02-16 17:40:00-0500

=== Xamarin Inspector ===

Version: 1.1.2.0
Hash: cdc01b9
Branch: 1.1-release
Build date: Wed, 22 Feb 2017 23:24:11 GMT

=== Build Information ===

Release ID: 602001821
Git revision: d41b6e51f3fa46a1943f2e31a778d28a7c73d069
Build date: 2017-02-17 15:18:19-05
Xamarin addins: 1363a8d943bab7700c93a97474060b6734aa7f94
Build lane: monodevelop-lion-cycle9

=== Operating System ===

Mac OS X 10.12.3
Darwin mac-trs2-swk1.dsone.3ds.com 16.4.0 Darwin Kernel Version 16.4.0
    Thu Dec 22 22:53:21 PST 2016
    root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64
Comment 3 tmrog 2017-03-13 18:45:01 UTC
Created attachment 20293 [details]
Test Project that also fails

This project presents a UI with 3 buttons.

use NSUrlSessionHandler
use HttpClientHandler
use default handler - this one uses the handler from the project settings

I discovered that once you use NSUrlSessionHandler and get a failure, the others will time out.

If you use HttpClientHandler first, then it works flawlessly many times.
Comment 4 tmrog 2017-03-13 18:45:24 UTC
Please find test project attached.
Comment 5 Rolf Bjarne Kvinge [MSFT] 2017-03-15 14:13:49 UTC
Test project attached
Comment 6 tmrog 2017-03-15 16:42:19 UTC
Not sure if this will help but Rolf had suggested for the FileProvide bug I submitted that I try using NSUrlSession directly.  I implemented that and got the exact same symptom until I set the headers in the request properly.
Comment 7 Sebastien Pouliot 2017-03-15 21:58:27 UTC
None of the handler works, but I can't ping the IP address inside the attached code.

However this sounds a lot like bug #52682 [1] which was fixed in XI 10.4.0.128 (C9 SR0) [2].

Can you try to update your version of XI, which was 10.4.0.123 based on comment #2 and let me know if this fixed the issue ?

Else just reply to the bug when the server is available again for testing.
Thanks!

[1] https://bugzilla.xamarin.com/show_bug.cgi?id=52682
[2] https://developer.xamarin.com/releases/ios/xamarin.ios_10/xamarin.ios_10.4/
Comment 8 tmrog 2017-03-15 22:09:46 UTC
Sebastien,

As I mentioned earlier in the trail, you would have to setup your own endpoint to try this.  This ip address is on a private intranet.  I provided the code just so you guys could check out what I was doing.

I've never updated an individual component.  Is it just a simple install?

Ted
Comment 9 Sebastien Pouliot 2017-03-15 22:55:16 UTC
@Ted, sorry I missed the earlier part - sadly it's not clear how the endpoint is configured so it's not really helpful.

In case you do not want to update everything to SR you can still use XS "Check for Updates...". Just wait for it to download all new stable software, then you can select (checkbox) which one you want to install, e.g. only Xamarin.iOS.

Once installation is complete you should restart XS.
Comment 10 tmrog 2017-03-16 11:44:13 UTC
I didn't realize that there was a new SR.  I had just checked for a new update earlier in the day.  I prefer to update to the SR.
Comment 11 tmrog 2017-03-16 12:37:35 UTC
Sebastien,

NSUrlSessionHandler seems to work fine after updating to the SR that includes Xamarin.iOS 10.4.0.128.

Also, I can step through code in the debugger again!

Ted
Comment 12 Sebastien Pouliot 2017-03-16 13:01:23 UTC
Glad this fixed the issue(s) and thanks for confirming :)

*** This bug has been marked as a duplicate of bug 52682 ***