[Mono-bugs] [Bug 77304][Min] New - Unnecessary exception in
ArrayList
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Thu Jan 19 10:02:58 EST 2006
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 n.h.m.aandebrugh at student.utwente.nl.
http://bugzilla.ximian.com/show_bug.cgi?id=77304
--- shadow/77304 2006-01-19 10:02:58.000000000 -0500
+++ shadow/77304.tmp.31582 2006-01-19 10:02:58.000000000 -0500
@@ -0,0 +1,40 @@
+Bug#: 77304
+Product: Mono: Class Libraries
+Version: 1.1
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Minor
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: n.h.m.aandebrugh at student.utwente.nl
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Unnecessary exception in ArrayList
+
+Description of Problem:
+Assigning a value to an element in an ArrayList using the indexer raises
+an exception. This is nice and all, but only if its really an error.
+The check in the setter should be made against "_items.Length" (i.e. the
+Capacity) not "_size" (i.e. the Count). With this implementation it's
+impossible to have "gaps" in the array.
+Forcing all elements to have some value could be a (imo no so good) design
+decision, but there is no check when assigning the default value null to
+an element, as long as its offset is <= count.
+
+Steps to reproduce the problem:
+1. IList aap = new ArrayList(); // default cap. is 16 for my version
+2. aap[0] = whatever
+
+Actual Results:
+ArgumentOutOfRangeException
+
+Expected Results:
+Perfectly legal, as long as index >= 0 && index < _items.Length
+
+How often does this happen?
+Every time.
More information about the mono-bugs
mailing list