Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
When reading from a stream returned by HttpWebResponse.GetResponseStream(), the Read() call is returning 0 when there is an error reading from the stream, causing the caller to incorrectly assume the end of the stream was reached successfully. The correct behavior is to throw an IOException.
This problem also exists for Xamarin.Android.
See this forum post for more details, repro steps, and repro code.
Bug report for Xamarin.Android here: https://bugzilla.xamarin.com/show_bug.cgi?id=15666
I can reproduce this with the test case from the forum post and the 20MB jpg link from bug #15666 comment 2.
Looks like some sort of race condition somewhere, since sometimes I got a proper exception.
I just discovered another factor today. If I have two simultaneous downloads, one small and one large being downloaded on different threads, when the small one finishes, the large one ends early ( Read() == 0 ). This seems to happen 100% consistently.
Huh. I have definitely seen image files download incorrectly and I ended up putting a manual check for content length matching afterwards to deal with it. I guess this is a another issue with httpwebrewuest.
Closing ancient bugs, please reopen if you're still having this problem.
@Oran and @TJ as @Marting mentioned this is a very old bug and we have not had any information since you reported it, I'm closing it unless you can reproduce it with any recent version of the software.