[Mono-bugs] [Bug 80139][Wis] New - Attribute.Equals and Attribute.GetHashCode default implementation inconsistent
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Sun Dec 3 11:19:55 EST 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 dominic_ullmann at hispeed.ch.
http://bugzilla.ximian.com/show_bug.cgi?id=80139
--- shadow/80139 2006-12-03 11:19:55.000000000 -0500
+++ shadow/80139.tmp.2310 2006-12-03 11:19:55.000000000 -0500
@@ -0,0 +1,67 @@
+Bug#: 80139
+Product: Mono: Class Libraries
+Version: 1.2
+OS: GNU/Linux [Other]
+OS Details: SLED 10 (Mono VM Ware Image)
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: dominic_ullmann at hispeed.ch
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Attribute.Equals and Attribute.GetHashCode default implementation inconsistent
+
+Description of Problem:
+The default implementation of Attribute.GetHashCode and Attribute.Equals
+are inconsistent, i.e. Attribute.Equals returns true for instances where
+Attribute.GetHashCode() returns different values.
+The return values differ also from the values of the .NET class library.
+
+Steps to reproduce the problem:
+
+1. Define a subclass of Attribute
+2. Create two instances of this class
+3. Call GetHashCode and Equals and compare the results.
+
+or with the attached example:
+
+1. Compile the attached example with mcs TestAttributeEquality.cs
+2. Run the attached example with mono TestAttributeEquality.exe
+
+
+Actual Results:
+on Mono 1.2:
+attr eq: True
+attr a1 hc: -1022477504
+attr a2 hc: 892325632
+
+i.e. the two attribute instances are considered equal, however, the
+hashcode is different (see also: method documentation for
+Object.GetHashCode -> there you can read, that for two instances, that are
+considered equal, the hashcode should be the same).
+
+on Mono 1.1.16.1:
+attr eq: False
+attr a1 hc: -1022477504
+attr a2 hc: 892325632
+
+In this case, the results were consistent; but different from .NET.
+
+on .NET 2.0:
+attr eq: True
+attr a1 hc: 12333200
+attr a2 hc: 12333200
+
+Attributes are considered equal and the hashcode is the same.
+
+Expected Results:
+At least consistent results from Equals and GetHashCode. Best would be the
+same behaviour as in .NET 2.0
+
+How often does this happen?
+always
More information about the mono-bugs
mailing list