[Mono-bugs] [Bug 75479][Maj] New - [GMCS] strange problem with Dictionary impl

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Jul 5 18:07:18 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 malekith at pld-linux.org.

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

--- shadow/75479	2005-07-05 18:07:18.000000000 -0400
+++ shadow/75479.tmp.10742	2005-07-05 18:07:18.000000000 -0400
@@ -0,0 +1,76 @@
+Bug#: 75479
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: amd64 pld linux
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: JIT
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: malekith at pld-linux.org               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [GMCS] strange problem with Dictionary impl
+
+Description of Problem:
+
+The following testcase:
+
+#v+
+
+using System.Text;
+using System.Collections.Generic;
+
+class C {
+static System.Random random = new System.Random (0);
+static string random_string ()
+{
+  StringBuilder sb = new StringBuilder (20);
+  for (int i =0; i<20;++i)
+    sb.Append ((char)((int)'a' + random.Next () % 30));
+  return sb.ToString ();
+}
+
+public static void Main () {
+
+for (int i = 0; i < 50000; ++i) {
+  Dictionary<string,string> h = new Dictionary<string,string>();
+  int c = random.Next () % 30;
+  for (int j = 0 ; j < c ; ++j)
+    h [random_string ()] = "foo";
+}
+}}
+#v-
+
+crashes with
+
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in <0x0001a>
+System.Collections.Generic.IEquatableOfTEqualityComparer`1[System.String]:GetHashCode
+(System.String )
+in <0x00049>
+System.Collections.Generic.Dictionary`2[System.String,System.String]:DoHash
+(System.String )
+in <0x000cf>
+System.Collections.Generic.Dictionary`2[System.String,System.String]:Resize ()
+in <0x0006b>
+System.Collections.Generic.Dictionary`2[System.String,System.String]:DoAdd
+(Int32 , System.String , System.String )
+in <0x00058>
+System.Collections.Generic.Dictionary`2[System.String,System.String]:set_Item
+(System.String , System.String )
+in <0x00088> C:Main ()
+
+However adding for example S.C.WriteLine to print number of created
+hashtable cures the problem.
+
+This is some strange runtime problem.
+
+It occurs on both x86 and x86_64, mono svn.
+
+It however does not occur in 1.1.8, though it can be by accident.


More information about the mono-bugs mailing list