[Mono-list] Errors in Exception Classes

Dwivedi , Ajay Kumar AjayKumar.Dwivedi@dresdner-bank.com
Sat, 16 Feb 2002 15:43:26 -0000


hi All,
	While going throught the source code I found some problems with the
following classes. Some of them are mere feature enhancement suggestions,
others may be bugs.

	System.ArgumentException 
*	Message Property is not overridden.
*	The constructor which takes paramName should append "\nParameter
Name: paramName" to the message. This would make the paramName information
available when someone does a catch(Exception e) followed by e.ToString().
(MS implementation does it and IMO its a good Idea)
	System.ArgumentOutOfRangeException 
*	Message Property is not overridden.
*	The constructor which takes paramName, and Actual value should
Append some information about them to the Message.

		Note that Message Property in Exception is virtual. So
Adding this information to Message Property and making Exception's ToString
Method use Message property instead of message field may do the trick.
BTW its funny that ArgumentException has constuctor ( string message ,
string paramName), while derived classes have constructors with parameters
reversed ,eg ArgumentNullException (string param_name, string message).

Referenced Code: Mono Snapshot 15th Feb

Happy Hacking,
Ajay kumar Dwivedi

--
#!!!	If anything can go wrong, _FIX_ it. (To hell with MURPHY)
							Dwivedi, Ajay kumar