[Mono-bugs] [Bug 39046][Min] New - Queue.CopyTo does not work on an empty queue.
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 firstname.lastname@example.org.
--- shadow/39046 Tue Mar 4 11:05:17 2003
+++ shadow/39046.tmp.31746 Tue Mar 4 11:05:17 2003
@@ -0,0 +1,46 @@
+Product: Mono/Class Libraries
+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();
+An ArgumentException is thrown.
+No exception is thrown, and nothing is copied.
+How often does this happen?
+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.