[Mono-dev] [PATCH] Uri.IsWellFormedUriString should not throw an exception.

Bill Holmes billholmes54 at gmail.com
Wed Jan 21 12:01:18 EST 2009


The attached patch fixes the attached test.cs.

Uri.IsWellFormedUriString calls the .ctor which throws an exception.
The .ctor throwing the exception is expected behavior,
IsWellFormedUriString throwing is not expected.

I would also like to apply this to the 2.4 branch.


2009-01-21  Bill Holmes  <billholmes54 at gmail.com>

	* Uri.cs (IsWellFormedUriString):  Changing IsWellFormedUriString
	  to not throw an exception but return false instead.

	Contributed under MIT/X11 license.
-------------- next part --------------
using System;

namespace ConsoleApplication1
    class Program
        static void Main(string[] args)
            string link = "adat";

            if (Uri.IsWellFormedUriString(link, UriKind.Absolute))   // <- Exception is thrown.
                Console.WriteLine("Good link");
                Console.WriteLine("Bad link");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: IsWellFormedOriginalString.patch
Type: text/x-diff
Size: 1205 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090121/d7302eba/attachment.bin 

More information about the Mono-devel-list mailing list