Bug 970 - HttpUtility.ParseQueryString constructing with an empty string
Summary: HttpUtility.ParseQueryString constructing with an empty string
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web ()
Version: 2.10.x
Hardware: PC Linux
: --- minor
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2011-09-21 14:06 UTC by Nicholas Schell
Modified: 2011-09-21 16:41 UTC (History)
2 users (show)

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

Simple 1 class Console App example. Just add references for System and System.Web (661 bytes, text/x-csharp)
2011-09-21 14:06 UTC, Nicholas Schell

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 GitHub or Developer Community 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 Nicholas Schell 2011-09-21 14:06:20 UTC
Created attachment 458 [details]
Simple 1 class Console App example. Just add references for System and System.Web

When using HttpUtility.ParseQueryString() and feeding it an empty string will return a NameValueCollection rather than an empty HttpValueCollection. The attachment provides a basic example. This seems to work absolutely fine with Microsoft's .NET System.Web. Tested with Visual Studio 2010 and a .NET4 project.

I am working on Ubuntu 11.04 (Natty) with MonoDevelop 2.6 and Mono 2.10.5. I got the more recent MonoDevelop/Mono binaries from this PPA: https://launchpad.net/~ermshiperete/+archive/monodevelop

I also tested with the versions packaged in Ubuntu's Natty repos (MonoDevelop 2.4 and Mono 2.6.7) which has the same result.

Tried with all versions of .NET: 1.1, 2, 3, 3.5, 4. All produced the same results.

Not exceedingly important, but becomes a bit of a hassle since you have to initially create with some other string then remove it from the collection afterwards in order to get a usable empty HttpValueCollection.
Comment 1 Gonzalo Paniagua Javier 2011-09-21 14:19:46 UTC
I don't think we're modifying this. The method returns NameValueCollection and HttpValueCollection was(is?) an internal class in MS implementation. Also this method is only available in 2.0+.
Comment 2 Gonzalo Paniagua Javier 2011-09-21 15:11:18 UTC
Reading this again, I realized that this was fixed a long time ago (2009). I guess it never made it to the 2.6.x series (we are now in the 2.10.x series).
Comment 3 Nicholas Schell 2011-09-21 16:07:23 UTC
I was also testing with 2.10.5 though, and it displays the issue.
Comment 4 Gonzalo Paniagua Javier 2011-09-21 16:20:50 UTC
Fixed in master fe96470 and mono-2-10/37ac996
Comment 5 Nicholas Schell 2011-09-21 16:35:25 UTC
Just to make sure I understand, are you saying it was fixed right now? Or that according to the latest git commits it is ok?

I just tried the officially packaged Mono 2.10.5 installer for Windows, and the same issue presents itself there as well.
Comment 6 Nicholas Schell 2011-09-21 16:41:11 UTC
Nm I see it now in the git history, thanks!