Bug 42936 - 401 code not returned when using NSURLSession HTTPClient handler
Summary: 401 code not returned when using NSURLSession HTTPClient handler
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll (show other bugs)
Version: XI 9.8 (tvOS / C7)
Hardware: PC Windows
: Normal critical
Target Milestone: (C9)
Assignee: Manuel de la Peña
URL:
Depends on:
Blocks:
 
Reported: 2016-07-29 22:39 UTC by Cody Beyer (MSFT)
Modified: 2016-11-18 09:22 UTC (History)
6 users (show)

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


Attachments

Description Cody Beyer (MSFT) 2016-07-29 22:39:35 UTC
# Description

The following sample makes a call to a web service using basic authentication. The auth values are not correct, so we would expect a 401 status code to be returned. However, when using the NSUrlSession implementation for HTTPClient, no such value is returned and the call times out

# Sample

Attached

# Steps to Reproduce

	1. Download and open sample
	2. Ensure that "NSUrlSession" is set under Properties > iOS Build > Advanced > HttpClient Implementation 
	3. Run

# Expected Results

Label in main view should state "Unauthorized"

# Actual Results

Call times out. To see expected results, start from step 2 but set the value to "Managed"

# Versions

Microsoft Visual Studio Professional 2015
Version 14.0.25424.00 Update 3
Microsoft .NET Framework
Version 4.6.01038

Installed Version: Professional

LightSwitch for Visual Studio 2015   00322-40000-00000-AA256
Microsoft LightSwitch for Visual Studio 2015

Visual Basic 2015   00322-40000-00000-AA256
Microsoft Visual Basic 2015

Visual C# 2015   00322-40000-00000-AA256
Microsoft Visual C# 2015

Visual C++ 2015   00322-40000-00000-AA256
Microsoft Visual C++ 2015

Visual F# 2015   00322-40000-00000-AA256
Microsoft Visual F# 2015

Windows Phone SDK 8.0 - ENU   00322-40000-00000-AA256
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   7.1.00719.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1   14.1.20624.0
ASP.NET and Web Tools 2015.1

ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.40314.0
For additional information, visit http://www.asp.net/

Azure App Service Tools v2.8.1   14.0.11123.0
Azure App Service Tools v2.8.1

Common Azure Tools   1.8
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

Microsoft .NET Core Tools (Preview 2)   14.1.20624.0
Microsoft .NET Core Tools (Preview 2)

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

NuGet Package Manager   3.5.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   14.0.60519.0
Microsoft SQL Server Data Tools

TypeScript   1.8.35.0
TypeScript tools for Visual Studio

Visual Studio Tools for Universal Windows Apps   14.0.25420.01
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin   4.1.1.3 (34a92cd)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Inspector Support   0.9.0.14 (4d868da)
Adds support for inspecting Xamarin and WPF apps.

Xamarin.Android   6.1.1.1 (7db2aac)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   9.8.1.4 (3cf8aae)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 3 Sebastien Pouliot 2016-10-11 17:23:07 UTC
PR merged in xamarin-macios/master 0d95c6846c3190baf466b8e40f8994965a49ef43
Comment 4 Saurabh 2016-10-12 09:32:01 UTC
I have checked this Issue with latest master build (XVS 4.3.0.23). I am seeing label as 'Unauthorized'. This is the screencast for the same: http://www.screencast.com/t/ijrkIO04u

Microsoft Visual Studio Professional 2013
Version 12.0.40629.00 Update 5
Microsoft .NET Framework
Version 4.6.01532

Installed Version: Professional

LightSwitch for Visual Studio 2013   06177-004-0446016-02642
Microsoft LightSwitch for Visual Studio 2013

Team Explorer for Visual Studio 2013   06177-004-0446016-02642
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06177-004-0446016-02642
Microsoft Visual Basic 2013

Visual C# 2013   06177-004-0446016-02642
Microsoft Visual C# 2013

Visual C++ 2013   06177-004-0446016-02642
Microsoft Visual C++ 2013

Visual F# 2013   06177-004-0446016-02642
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06177-004-0446016-02642
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Windows Phone SDK 8.0 - ENU   06177-004-0446016-02642
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   12.5.60612.0
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Microsoft Azure Web Apps
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Microsoft Azure

ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.30612.0
For additional information, visit http://www.asp.net/

Command Bus, Event Stream and Async Manager   Merq
Provides ICommandBus, IEventStream and IAsyncManager MEF services for loosely coupled Visual Studio extension components communication and integration.

Common Azure Tools   1.4
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

Mono Debugging for Visual Studio   Mono.Debugging.VisualStudio
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   2.8.60610.756
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Office Developer Tools for Visual Studio 2013 ENU   12.0.30626
Microsoft Office Developer Tools for Visual Studio 2013 ENU

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   12.0.41012.0
Microsoft SQL Server Data Tools

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   4.3.0.23 (6eb7239)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   7.0.99.118 (736438a)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   10.1.0.135 (0760023)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 5 Alan McGovern 2016-11-07 01:27:33 UTC
The fix introduced an uncatchable exception which is crashing my app ~instantly when run on an actual iOS 10 device:

https://github.com/xamarin/xamarin-macios/commit/0d95c6846c3190baf466b8e40f8994965a49ef43#commitcomment-19716381
Comment 6 Manuel de la Peña 2016-11-07 17:09:39 UTC
Landed in master: https://github.com/xamarin/xamarin-macios/pull/1127
Comment 7 Alan McGovern 2016-11-07 17:14:02 UTC
And cycle9?
Comment 8 Manuel de la Peña 2016-11-08 14:23:04 UTC
the patch was cherry-picked for c9 too: https://github.com/xamarin/xamarin-macios/commit/e42c5306eab97c91bf9d2ea78f9d75465e84b54d

Note You need to log in before you can comment on or make changes to this bug.