[Mono-bugs] [Bug 75124][Nor] New - [PATCH] IndexOutOfRangeException if URI starts with colon

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Jun 2 13:17:42 EDT 2005

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by gert.driesen at pandora.be.


--- shadow/75124	2005-06-02 13:17:42.000000000 -0400
+++ shadow/75124.tmp.12667	2005-06-02 13:17:42.000000000 -0400
@@ -0,0 +1,48 @@
+Bug#: 75124
+Product: Mono: Class Libraries
+Version: 1.1
+OS Details: 
+Status: NEW   
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: gert.driesen at pandora.be               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: [PATCH] IndexOutOfRangeException if URI starts with colon
+If the URI starts with a colon (and is more than 1 character long), then 
+an IndexOutOfRangeException is thrown in the Uri ctor while this 
+should've been an UriFormatException.
+To reproduce this issue, compile and run the following code snippet:
+using System;
+public class UriTest {
+  public static void Main() {
+    new Uri(":whatever");
+  }
+Actual result:
+Unhandled Exception: System.IndexOutOfRangeException: Array index is out 
+of range.
+Expected result:
+Unhandled Exception: System.UriFormatException: Invalid URI: The format 
+of the URI could not be determined.
+(this is the result you get on MS.NET 1.x and 2.x)
+The attached patch fixes this (minor) issue and adds a unit test.

More information about the mono-bugs mailing list