-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix ArgumentNullException messages passed as parameter names #2889
Conversation
Is it still to soon to use nameof() in coreclr? |
I think it's corefx only at the moment |
@@ -36,7 +36,7 @@ public abstract class FieldInfo : MemberInfo, _FieldInfo | |||
public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle) | |||
{ | |||
if (handle.IsNullHandle()) | |||
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle")); | |||
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle"), "handle"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these parameters backwards i.e. shouldn't "handle" come before the GetResourceString call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, as this is an ArgumentException
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nvm, just looked it up and the order is reversed for ArgumentException. That's confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very! Stumped me more than a few times
Changes look good to me. |
Fixed several ArgumentNullExceptions that throw with the message as the parameter name, leading to potential confusion for developers.
@jkotas please take a look, this has been reviewed but unmerged for a while :) |
LGTM. Thanks! Sorry for the delay. Would you mind porting the applicable fixes to CoreRT as well? |
Will do |
…coreclr#2889) Fixed several ArgumentNullExceptions that throw with the message as the parameter name, leading to potential confusion for developers. Commit migrated from dotnet/coreclr@ad2485b
Found one weird parameter name, and git grepped the mscorlib folder to fix the others