http://bugzilla.novell.com/show_bug.cgi?id=567617
http://bugzilla.novell.com/show_bug.cgi?id=567617#c0 Summary: System.Object.ReferenceEquals is incorrectly implemented also causes performance loss Classification: Mono Product: Mono: Class Libraries Version: SVN Platform: All OS/Version: All Status: NEW Severity: Normal Priority: P5 - None Component: System AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: Other Blocker: No Description of Problem: I think fixing this can improve performance, because it'll replace full method resolution for op_equal by just pointer comparison. While inspecting /trunk/mcs/class/corlib/System/Object.cs I found this: // <summary> // Tests whether a is equal to b. // Can not figure out why this even exists // </summary> [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)] public static bool ReferenceEquals (object a, object b) { return (a == b); } This is not correct. ReferenceEquals() should return true IF AND ONLY IF a and b is THE SAME *INSTANCE*. Steps to reproduce the problem: string s1 = new string('x',13); string s2 = new string('x',13); bool res = object.ReferenceEquals(s1, s2); Actual Results: res == true Expected Results: res == false How often does this happen? always Additional Information: See http://bytes.com/topic/c-sharp/answers/252465-what-difference-equals-referenceequals http://www.mono-project.com/Gendarme.Rules.Correctness http://msdn.microsoft.com/en-us/library/system.object.referenceequals.aspx -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
