[Mono-bugs] [Bug 39046][Min] New - Queue.CopyTo does not work on an empty queue.

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Tue, 4 Mar 2003 11:05:17 -0500 (EST)


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 kalrac@vgmusic.com.

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

--- shadow/39046	Tue Mar  4 11:05:17 2003
+++ shadow/39046.tmp.31746	Tue Mar  4 11:05:17 2003
@@ -0,0 +1,46 @@
+Bug#: 39046
+Product: Mono/Class Libraries
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: kalrac@vgmusic.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Queue.CopyTo does not work on an empty queue.
+
+Description of Problem:
+Queue.CopyTo(Array, int) will not work if the Queue is empty, and the 
+index equals the Array length.  More specifically, if the Queue is empty, 
+the Array is 0 length, and the index is 0, which is the situation which 
+will occur when attempting to call Queue.ToArray() on an empty Queue.
+
+
+Steps to reproduce the problem:
+Queue q = new Queue();
+q.ToArray();
+
+Actual Results:
+An ArgumentException is thrown.
+
+
+Expected Results:
+No exception is thrown, and nothing is copied.
+
+
+How often does this happen?
+Every time.
+
+
+Additional Information:
+This is an issue with the "index >= array.Length" condition in the third 
+sanity check within Queue.CopyTo(Array, int).  Ordinarily, this is a valid 
+check, however, when the Queue count is 0, the index should be permitted 
+to be equal to array.Length, as nothing will actually be copied.