1

I am porting non-PCL code to PCL and I am stuck with the HttpClient (beyond other, but straight forward problems): I was reading a number of questions&answers in here to make sure I do the right thing and now I use the HttpClient from Microsoft for PCL version 2.2.29 and BCL version 1.1.10.

My problem is way before the problems reported in the other questions about behaviour on Android or iOS: in my case some very basic classes and enum values are missing in my HttpClient implementation (in comparison to non-PCL HttpClient):

1) HttpWebRequest.Timeout (beyond other properties that are missing)

2) webRequest.ContentLength (ContentType is defined!)

3) WebExceptionStatus.ConnectionClosed (many others are also missing)

4) Authenticator (missing entirely!)

I checked online documentation of the library and it actually refers to PCL compatible HttpClient explicitly but does not mention any missing classes, enum values or properties in the library.

I saw some answers that covered the topic of which HttpClient to use, but I could not find the post (again) where it talked about the lastest changes in HttpClient being either part of PCL or something (being confused now).

Any hints?

1 Answer 1

1

The PCL version of HttpClient has limitations compared to the non-portable version, and this is not specific to Xamarin but rather to the PCL as a whole.

However, the best solution I have found is to use ModernHTTPClient, which offers a portable version that should offer the calls that you need.

You can also look at doing some tricky things with the PCL itself, similar to as described in the following blog post but I suggest giving ModernHTTPClient a try first.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you sir, I will go with ModernHTTPClient next thing!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.