[Mono-bugs] [Bug 75545][Nor] New - [PATCH] ArrayList:GetRange:ToArray ignores range index

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Jul 13 21:39: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 flgr at ccan.de.

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

--- shadow/75545	2005-07-13 21:39:18.000000000 -0400
+++ shadow/75545.tmp.22096	2005-07-13 21:39:18.000000000 -0400
@@ -0,0 +1,49 @@
+Bug#: 75545
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: independent
+Status: NEW   
+Resolution: 
+Severity: 001 One hour
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: flgr at ccan.de               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [PATCH] ArrayList:GetRange:ToArray ignores range index
+
+Description of Problem:
+
+ArrayList:GetRange(index, count) is optimized. It returns a RangedArrayList
+which just keeps a reference to the origin array list plus the index and
+count arguments supplied to it.
+
+However, RangedArrayList:ToArray (both with and without a type) does not
+use its own index argument -- it always defaults to 0 instead. This is
+evident in the following code:
+
+char[] chars = {'a', 'b', 'c', 'd', 'e', 'f'};
+ArrayList a = new ArrayList(chars);
+ArrayList b = a.GetRange(3, 3);
+object[] obj_chars = b.ToArray ();
+
+obj_chars now refers to {'a', 'b', 'c'} instead of {'d', 'e', 'f'}.
+
+Steps to reproduce the problem:
+1. Run test case from patch.
+
+Actual Results:
+
+Index ignored, returns first count elements. (Here: {'a', 'b', 'c'})
+
+Expected Results:
+
+Index used, returns elements four through six. (Here: {'d', 'e', 'f'})
+
+How often does this happen? 
+
+Always.


More information about the mono-bugs mailing list