[Mono-list] Microsoft.VisualBasic.Collection Exception problems

Chris J. Breisch cjbreisch@altavista.net
Sat, 11 May 2002 10:55:13 -0500


FYI,

Visual Basic Language reference states that for class
Microsoft.VisualBasic.Collection:

	ReadOnly Public Default Overloads Property Item( _
	   ByVal Index As { Integer | Object } _
	) As Object


should throw an IndexOutOfRangeException when "Index doesn't match an
existing member of the collection."

It properly does so, if Index is an invalid Integer, but throws
ArgumentException if Index is an invalid Object.

Further, the Collection class implements IENumerable (by way of IList),
and the on-line documentation for the IENumerable interface states:

	object Current {get;}

should throw an InvalidOperationException when "The enumerator is
positioned before the first element of the collection or after the last
element."

Instead, the Collection class throws an IndexOutOfRangeException.

Further, the on-line documentation for IENumerable also states:

	bool MoveNext();

and

	void Reset();

should throw an InvalidOperationException when "The collection was
modified after the enumerator was created."

Instead, no exception is thrown at all.

These are amply demonstrated by the attached file (ripped from my
TestCollection.cs Nunit Test)


Will be adding these to mcs/class/doc/API-notes when I can.

			-chris



Chris J. Breisch, MCSD, MCDBA