What happened here?

Here’s a number of inconsistencies with exception constructors:

The message parameter is first and paramName is second for one of ArgumentException’s constructors.
public ArgumentException(string message, string paramName);

These exceptions inherit ArgumentException:

  • In one of ArgumentOutOfRangeException’s constructors, paramName is first and message is second.
    public ArgumentOutOfRangeException(string paramName, string message);
  • In one of InvalidEnumArgumentException’s constructors, argumentName is used to represent the same value as paramName. This is an overload that doesn’t include the message parameter, which is normal.public InvalidEnumArgumentException(string argumentName, int invalidValue, Type enumClass);
  • In one of DuplicateWaitObjectException’s constructors, parameterName is first, represents the same value as paramName, and message is second.
    public DuplicateWaitObjectException(string parameterName, string message);



Questions:


  1. Why are there three names used to represent paramName?

  2. Why was the parameter order changed in the child classes?

One comment on “What happened here?

  1. I think that conversation played out something like this.

    Left Hand: Hey Right, what are you up to?
    Right Hand: I told you yesterday.
    Left Hand: What? No you didn’t
    Right Hand: Dude, do you even listen to me when I talk?
    Left Hand: Dammit Right, I don’t have time to listen to you blather on about your empty existance.
    Right Hand: *slumps head and frowns* bbbut, I thought you cared *whimper*

Comments are closed.