[Mono-bugs] [Bug 78799][Wis] Changed - Missing operator == on Uri class

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Aug 1 06:09:42 EDT 2006


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 alan.mcgovern at gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=78799

--- shadow/78799	2006-07-08 18:06:04.000000000 -0400
+++ shadow/78799.tmp.6852	2006-08-01 06:09:41.000000000 -0400
@@ -1,14 +1,14 @@
 Bug#: 78799
 Product: Mono: Class Libraries
 Version: 1.1
-OS: 
+OS: unknown
 OS Details: 
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Wishlist
 Component: System
 AssignedTo: mono-bugs at ximian.com                            
 ReportedBy: tomas_matousek at hotmail.com               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
@@ -20,6 +20,42 @@
 
 Unhandled Exception: System.MissingMethodException: Method not 
 found: 'System.Uri.op_Equality'.
 
 The method is implemented in .NET Framework 2.0 but not in Mono which 
 prevents smooth migration.
+
+------- Additional Comments From alan.mcgovern at gmail.com  2006-08-01 06:09 -------
+These methods are now in the URI class, so this could be closed...
+
+Also, i believe the implementation of these methods is flawed. From 
+MSDN you can see that the inequality method return value is as 
+follows:
+
+true if the two Uri instances are not equal; otherwise, false. If 
+either parameter is a null reference (Nothing in Visual Basic), this 
+method returns true.
+
+And when checking for equality:
+UserInfo and Fragment content is ignored when making this comparison.
+
+The obvious mistakes i've noticed so far are that UserInfo is taken 
+into account when checking for equality. Also, it's possible that 
+equals will return true if one of the parameters is null, which is 
+wrong. I'm not sure how fragment checking works... but that may also 
+be broken.
+
+Here's an updated method which fixes those two bugs. It would still 
+need testing to make sure fragments are being correctly ignored:
+
+		public static bool operator == (Uri u1, Uri u2)
+		{
+			if (u1 == null || u2 == null)
+                            return false;
+
+			return u1.scheme == u2.scheme &&
+				u1.host == u2.host &&
+				u1.port == u2.port &&
+				u1.path == u2.path &&
+				u1.query == u2.query;
+		}
+


More information about the mono-bugs mailing list