[Mono-bugs] [Bug 61919][Nor] New - Problem when inheriting from Collections.Queue

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 25 Jul 2004 05:48:17 -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 jhr.walter@t-online.de.

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

--- shadow/61919	2004-07-25 05:48:16.000000000 -0400
+++ shadow/61919.tmp.18273	2004-07-25 05:48:17.000000000 -0400
@@ -0,0 +1,77 @@
+Bug#: 61919
+Product: Mono: Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jhr.walter@t-online.de               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Problem when inheriting from Collections.Queue
+
+The following program
+
+----------
+using System;
+using System.Collections;
+
+public class BlockingQueue1 : Queue
+{
+    public BlockingQueue1() :
+        base(new Queue())
+    {}
+
+    public override void Enqueue(object message)
+    {
+        base.Enqueue(message);
+    }
+}
+
+public class BlockingQueue2
+{
+    private Queue queue;
+
+    public BlockingQueue2()
+    {
+        queue = new Queue();
+    }
+
+    public void Enqueue(object message)
+    {
+        queue.Enqueue(message);
+    }
+}
+
+public class App
+{
+    public static void Main()
+    {
+        BlockingQueue1 queue = new BlockingQueue1();
+        // BlockingQueue2 queue = new BlockingQueue2();
+        queue.Enqueue(1);
+    }
+}
+----------
+
+produces the output
+
+----------
+Unhandled Exception: System.IndexOutOfRangeException: Array index is out 
+of range.
+in (unmanaged) (wrapper managed-to-native) 
+System.Object:__icall_wrapper_helper_stelem_ref (intptr,int,object)
+in <0x00004> (wrapper managed-to-native) 
+System.Object:__icall_wrapper_helper_stelem_ref (intptr,int,object)
+in <0x0005c> System.Collections.Queue:Enqueue (object)
+in <0x0000d> BlockingQueue1:Enqueue (object)
+in <0x00045> App:Main ()
+----------
+
+The version containing an instance of Queue works fine.