-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Using HttpCompletionOption.ResponseHeadersRead in HttpClient is throwing error as responce content size increase #4695
Comments
Cross-referencing note for the Xamarin.Android team This issue appears similar to #4691 |
@sasivishnu The problem here is that while your request is made on a separate thread (the
|
@grendello thanks for quick check on this. Sorry for late reply (busy with personal life). No Deserializing in seperate thread using For anyone reference, I made below code change in above attached repo and it works.
|
Description
We are using single instance HttpClient (Default HttpClient Implementation) in our app and
SendAsync
is passed with parameterHttpCompletionOption.ResponseHeadersRead
. When response content size is less (ex: array of 10/20 Json objects), then API call is succeeding but if response content size is more, we are getting error in Android. We have released our app to production and encountered strange error in Android API call.Could you please take a look & let me know what's going wrong?
Error Message:
Same API call in our app with size of 100 array of json objects working fine when used with
HttpCompletionOption.ResponseContentRead
. So, there seems to be something going wrong when usingHttpCompletionOption.ResponseHeadersRead
.As of now, iOS seems to be working. Only in Android, there is issue.
Steps to Reproduce
Try to receive large json object content size with
HttpCompletionOption.ResponseHeadersRead
option in HttpClient in Android. Attached reproduction repo sample to re-produce the issue. Even for smaller json object content size, it failing sometimes (harder to re-produce).Code sample:
Expected Behavior
Making GET Rest API call with
HttpCompletionOption.ResponseHeadersRead
should work fine and consistently across varying size of response content.Actual Behavior
GET Rest API call with
HttpCompletionOption.ResponseHeadersRead
is throwing error when receiving large array of json objects.Basic Information
Screenshots
Reproduction Link
HttpTest.zip
Toggle to change API to fetch small number of items. By default (toggle false), it will fetch 50 objects (array) in Json. If you toggle to true and click the button, it will make API call to fetch 6 items in Json.
Workaround
Removing
HttpCompletionOption.ResponseHeadersRead
and using defaultHttpCompletionOption.ResponseContentRead
works in Emulator.The text was updated successfully, but these errors were encountered: