[Mono-bugs] [Bug 49397][Min] New - Bugs in Hashtable (Keys, Values, ContainsValue)

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 6 Oct 2003 21:35:18 -0400 (EDT)


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 barce@frlp.utn.edu.ar.

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

--- shadow/49397	2003-10-06 21:35:18.000000000 -0400
+++ shadow/49397.tmp.3438	2003-10-06 21:35:18.000000000 -0400
@@ -0,0 +1,38 @@
+Bug#: 49397
+Product: Mono/Class Libraries
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: barce@frlp.utn.edu.ar               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Bugs in Hashtable  (Keys, Values, ContainsValue)
+
+Description of Problem:
+Reviewing the code I found a few bugs in Hashtable.
+
+a) method ContainsValue
+     Throws an exception when "value" is null. It's legal to search for
+null values. The exception is thrown because value.Equals is called when
+value is null.
+
+b) Keys and Values properties
+      MS .NET always return a reference for the same object. Mono creates a
+new object every time it's called. 
+
+c) several throw statements don't create the exception objects in the same
+way MS .NET does. In most cases MS .NET fills the ParamName property while
+mono does not.
+
+d) This is not a bug, it's just an optimization: in method Remove 'Slot []
+table = this.table;' should be moved inside the if statement.
+
+I'm attaching testcases and a patch for Hashtable.cs