[Mono-bugs] [Bug 75168][Maj] Changed - Dictionary class loses data
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Tue Jun 7 18:44:14 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 radical at gmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=75168
--- shadow/75168 2005-06-07 05:56:44.000000000 -0400
+++ shadow/75168.tmp.19603 2005-06-07 18:44:14.000000000 -0400
@@ -91,6 +91,49 @@
key number 6 is -455592055 and d[-455592055] = 8
key number 7 is 67 and d[67] = 7
key number 8 is -455592055 and d[-455592055] = 8
key number 9 is 67 and d[67] = 7
key number 10 is -455592055 and d[-455592055] = 8
+
+------- Additional Comments From radical at gmail.com 2005-06-07 18:44 -------
+A more specific test case:
+
+using System.Collections.Generic;
+using System;
+
+public class App {
+ public static void Main() {
+ IDictionary<int, int> d = new Dictionary<int, int>();
+//*****************************
+ d [9] = 1;
+ d [10] = 1;
+ d [19] = 1;
+//*****************************
+ ICollection<int> vs = d.Values;
+
+ int count = 0;
+ foreach (int i in vs) {
+ count++;
+ System.Console.WriteLine("item number {0} is
+{1}", count, i);
+ }
+
+ System.Console.WriteLine("counted {0} when it should
+be {1}",
+ count, vs.Count);
+
+ int keycount = 0;
+ foreach (int key in d.Keys) {
+ keycount++;
+ System.Console.WriteLine("key number {0} is
+{1} and d[{1}] = {2}",
+ keycount, key, d[key]);
+ }
+ }
+}
+---------------
+
+Problem occurs when more than 1 key hashes to the last element in the
+table. (9, when table size is 10).
+
+Proposed patch is attached.
More information about the mono-bugs
mailing list