Bug 17132 - HttpRequestMessage fails in Xam.iOS and Xam.Android but works in .NET 4.5
Summary: HttpRequestMessage fails in Xam.iOS and Xam.Android but works in .NET 4.5
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: General (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2014-01-08 19:17 UTC by Jon Goldberger [MSFT]
Modified: 2014-01-13 08:48 UTC (History)
3 users (show)

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


Attachments
.NET 4.5 test project (33.86 KB, application/zip)
2014-01-08 19:17 UTC, Jon Goldberger [MSFT]
Details
Xam.iOS and Xam.Android test project (21.70 KB, application/zip)
2014-01-08 19:18 UTC, Jon Goldberger [MSFT]
Details

Comment 1 Jon Goldberger [MSFT] 2014-01-08 19:18:04 UTC
Created attachment 5797 [details]
Xam.iOS and Xam.Android test project
Comment 2 Jon Goldberger [MSFT] 2014-01-08 19:19:22 UTC
From case file:
"On Windows 8.1 with .NET 4.5, I can do the following (where hrm is an HttpRequestMessage)...

hrm.Headers.Add("Accept", "application/vnd.citrix.requesttokenresponse+xml, application/vnd.citrix.requesttokenchoices+xml");

On Xamarin.iOS, this is throwing a run-time System.FormatException.

Thoughts, please? I'm fine with altering my code in any way, so long as I can get the same effect on both platforms. Thanks!"

----------------------------------------------------------------------------
From me:
I confirmed this behavior. Test projects are attached.
Comment 3 Miguel de Icaza [MSFT] 2014-01-10 13:34:11 UTC
For now, split the two mime types into separate calls to Add like this:

hrm.Headers.Add("Accept", "application/vnd.citrix.requesttokenresponse+xml");
hrm.Headers.Add("Accept", "application/vnd.citrix.requesttokenchoices+xml");
Comment 4 Dominique Louis 2014-01-10 14:32:59 UTC
Another alternative is....

hrm.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/vnd.citrix.requesttokenresponse+xml"));
hrm.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/vnd.citrix.requesttokenchoices+xml"));
Comment 5 Marek Safar 2014-01-13 08:48:32 UTC
Fixed in mono master

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