-
Notifications
You must be signed in to change notification settings - Fork 468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port CA2208: InstantiateArgumentExceptionsCorrectly #742
Conversation
compilationContext => | ||
{ | ||
Compilation compilation = compilationContext.Compilation; | ||
ITypeSymbol stringType = compilation.GetSpecialType(SpecialType.System_String); |
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.
You don't need to fetch/store the special types. Instead you can directly ask for the special type on the type symbols. Basically replace your argument.Parameter.Type != stringType
checks with argument.Parameter.Type.SpecialType != SpecialType.System_String
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.
Cool. Fixed.
d18758b
to
ff57cee
Compare
ff57cee
to
7f2836b
Compare
|
||
|
||
private const string s_helpUri = "https://msdn.microsoft.com/en-us/library/ms182347.aspx"; | ||
|
||
internal static DiagnosticDescriptor NoArgumentsRule = new DiagnosticDescriptor(RuleId, |
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.
/cc @srivatsn This seems to be another rule where FXCop generates different diagnostic messages for same Rule ID. @nguerrera We have decided to avoid having multiple descriptors with the same Rule ID which differ only in the containing message. You should create a single descriptor with a placeholder message format "{0}" and provide specific message as a messageArgument to Diagnostic.Create method.
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.
Fixed.
LGTM |
👍 |
Port CA2208: InstantiateArgumentExceptionsCorrectly
#531 (fixer to follow in another PR)