Bug 5899 - WebClient.DownloadStringAsync seems to ignore QueryString values
Summary: WebClient.DownloadStringAsync seems to ignore QueryString values
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 5.3.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Martin Baulig
URL:
Depends on:
Blocks:
 
Reported: 2012-06-27 23:01 UTC by Miles Egan
Modified: 2012-09-05 13:50 UTC (History)
4 users (show)

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

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:
Status:
RESOLVED FIXED

Description Miles Egan 2012-06-27 23:01:08 UTC
It seems as if WebClient.DownloadStringAsync is not using the values of the QueryString property. 

For example:

            var url = new Uri("http://localhost:8080/");
            var wc = new WebClient();
            wc.QueryString = new NameValueCollection {
                {"q", term},
                {"output", "json"},
                {"rows", "50"},
            };
            wc.DownloadString(url); // this sends properly encoded request
            wc.DownloadStringAsync(url); // this throws away the query string
Comment 1 Rolf Bjarne Kvinge [MSFT] 2012-06-28 07:05:37 UTC
Gonzalo, is this your area?
Comment 2 Gonzalo Paniagua Javier 2012-06-28 16:36:59 UTC
It is not :), but this problem has an easy solution. The issue is that the same problem happens in all (I think) *Async() entry points and some of the synchronous ones that take a Uri as argument. Also, while checking out the file, I realized that the threads created for *Async() are not background threads as they should.
Comment 3 Martin Baulig 2012-09-04 14:58:53 UTC
Fixing the query string is really trivial.

Regarding the threads for the *Async() methods,  think that these should just become wrappers around the *TaskAsync() methods in the 4.5 profile.  Using Thread.Interrupt really sucks (well, it was the only way of doing it prior to .NET 4.5).
Comment 4 Martin Baulig 2012-09-04 15:26:16 UTC
I fixed the query string issue (master commit 651408) and filed a new bug #6904 to give this class some more love.
Comment 5 Miles Egan 2012-09-04 21:41:20 UTC
Thanks for looking into this!
Comment 6 Martin Baulig 2012-09-05 13:50:13 UTC
You're welcome :-)