[Mono-bugs] [Bug 47310][Nor] New - CollectionBase Indexer's behavior differs from .NET's
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Sun, 3 Aug 2003 17:21:40 -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 barce@frlp.utn.edu.ar.
http://bugzilla.ximian.com/show_bug.cgi?id=47310
--- shadow/47310 Sun Aug 3 17:21:40 2003
+++ shadow/47310.tmp.1346 Sun Aug 3 17:21:40 2003
@@ -0,0 +1,103 @@
+Bug#: 47310
+Product: Mono/Class Libraries
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: barce@frlp.utn.edu.ar
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: CollectionBase Indexer's behavior differs from .NET's
+
+Description of Problem:
+
+This method has two bugs:
+BUG#1) Mono Calls OnValidate method before checking if argument is out of
+range. .NET throws ArgumentOutOfRange exception, not calling OnValidate.
+
+BUG#2) After setting the new value into InnerList if OnSetComplete throws
+an exception mono does not undo the transaction.
+
+
+Steps to reproduce BUG#1:
+using System;
+using System.Collections;
+
+namespace PruebaBugCollectionBase
+{
+ class MyCollection: CollectionBase
+ {
+
+
+ protected override void OnValidate(object value)
+ {
+ throw new ApplicationException("OnValidate Called!!!");
+ }
+
+ }
+
+ class Class1
+ {
+ static void Main(string[] args)
+ {
+ IList c = new MyCollection();
+ c[5] = 8888;
+ }
+ }
+}
+
+
+Actual Results:
+OnValidate is called....
+
+Expected Results:
+.NET Framework throws a ArgumentOutOfRangeException not calling OnValidate.
+
+How often does this happen? Always
+
+Steps to reproduce BUG#2:
+namespace PruebaBugCollectionBase
+{
+ class MyCollection: CollectionBase
+ {
+
+
+ protected override void OnSetComplete(int index, object
+oldValue, object newValue)
+ {
+ throw new ApplicationException("OnSetComplete
+Called!!!");
+ }
+
+ }
+
+ class Class1
+ {
+ static void Main(string[] args)
+ {
+ IList c = new MyCollection();
+ c.Add(88);
+ try {
+ c[0] = 11;
+ } finally {
+ Console.WriteLine("Value c[0]: {0}", c[0]);
+ }
+ }
+ }
+}
+
+Actual Results:
+Value c[0]: 11
+
+Expected Results:
+.NET Framework returns
+Value c[0]: 88
+
+How often does this happen? Always