[Mono-bugs] [Bug 75790][Nor] Changed - InvalidCastException from cloned synchronized Hashtable that doesn't come from original hashtable.

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Sep 1 02:35:10 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 atsushi at ximian.com.

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

--- shadow/75790	2005-08-12 01:25:18.000000000 -0400
+++ shadow/75790.tmp.6250	2005-09-01 02:35:10.000000000 -0400
@@ -1,14 +1,14 @@
 Bug#: 75790
 Product: Mono: Class Libraries
 Version: 1.1
-OS: 
+OS: unknown
 OS Details: Linux-2.6.8-2-k7-i686-with-debian-3.1
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Normal
 Component: System
 AssignedTo: mono-bugs at ximian.com                            
 ReportedBy: Nev at Delap.com               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
@@ -57,6 +57,43 @@
     {
         Console.WriteLine("Please Note: Mono is (still) broken. See: 
 http://bugzilla.ximian.com/show_bug.cgi?id=???");
     }
 #endif
 }
+
+------- Additional Comments From atsushi at ximian.com  2005-09-01 02:35 -------
+Actually what I get from MS.NET is InvalidOperationException.
+
+And the expected behavior is different. Here is the modified repro
+(and more importantly, it *compiles*):
+
+--------
+
+using System;
+using System.Collections;
+
+public class Test
+{
+	public static void Main ()
+	{
+{
+    try
+    {
+        // This doesn't work... (Synchronized hashtable, GetEnumerator
+on clone of hashtable)
+        Hashtable hashtable = Hashtable.Synchronized(new Hashtable());
+        hashtable["a"] = 1;
+        IEnumerator enumerator2 = (hashtable.Clone() as 
+ICollection).GetEnumerator();
+        enumerator2.Reset();
+        enumerator2.MoveNext();
+        DictionaryEntry dictionaryEntry2 = (DictionaryEntry)
+enumerator2.Current; // << Throws.
+	Console.WriteLine ("InvalidOperationException is expected.");
+    } catch (InvalidOperationException) {
+	Console.WriteLine ("OK");
+    }
+}
+	}
+}
+


More information about the mono-bugs mailing list