Bug 25430 - HttpWebRequest AutomaticDecompression fails
Summary: HttpWebRequest AutomaticDecompression fails
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 4.18.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Marek Habersack
Depends on:
Reported: 2014-12-16 09:47 UTC by Luzanne
Modified: 2016-08-30 21:39 UTC (History)
2 users (show)

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

TestCase (12.05 KB, application/octet-stream)
2014-12-16 09:47 UTC, Luzanne
Testcase with webrequest (11.81 KB, application/octet-stream)
2015-02-11 11:18 UTC, Luzanne

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:

Description Luzanne 2014-12-16 09:47:16 UTC
Created attachment 9087 [details]

Downloading zipped content fails after second request.

See testcase in the attachment. Run the example.
When enabling AutomaticDecompression on the HttpWebRequest it is failing, but when you turn it off it works as expected.

Xamarin.Android is working as expected
Xamarin.Android not working
Comment 1 Luzanne 2014-12-17 05:41:14 UTC
Sorry, I was too fast with the previous ticket.

The testcase is downloading 12 random images. You should see 12 images when it is ready (version, but in version the download stops after 2/3 images.
Comment 2 Sadik Ali 2015-01-02 07:07:23 UTC
I have checked this issue and I am able to reproduce this issue. I observed that when I enable the AutomaticDecompression on the HttpWebRequest I am getting an exception i.e., 

System.NullReferenceException: Object reference not set to an instance of an object 

When I disable the AutomaticDecompression on the HttpWebRequest I observed that I am not getting any error/exception and application is working fine.

Screencast: http://www.screencast.com/t/NWPGfch86lm

Application Output: https://gist.github.com/RamChBachkheti/aebff551bd9b9ff8713f
IDE logs: https://gist.github.com/RamChBachkheti/31590b80b1b343ac3fbf
Device logs: https://gist.github.com/RamChBachkheti/860eaf05e27e45d51269

Environment Info:

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.50938
Installed Version: Professional
Xamarin (10cfd178d55287f09c85f5a1e604dfe20889a40f)
Xamarin.Android (ba9bbbdd44cfdc4bf485e8885bd2ad24fba525f7)
Xamarin.iOS (840a925103a0bf4a856507f13d5eaee3c1579c2f)
Comment 3 Luzanne 2015-02-11 11:18:17 UTC
Created attachment 9763 [details]
Testcase with webrequest
Comment 4 Luzanne 2015-02-11 11:21:29 UTC
I added a better testcase to this issue.

I've created MyWebRequest and override some methods.

When you run this code on version 4.18 and later, it stops when you call on line 52

response = base.EndGetResponse(asyncResult); 

and after the webrequest time out you trigger the catch in that function.
Comment 5 Marek Habersack 2016-08-30 21:39:40 UTC
The provided sample works fine with the current master and cycle8 versions of XA (Cycle 8 is soon to be released)