Skip to content
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

ArgumentException / ArgumentNullException / ArgumentOutOfRangeException usage #34

Open
amanda-mitchell opened this issue Jan 7, 2019 · 0 comments
Labels
new analyzer Suggestion for a new analyzer to add

Comments

@amanda-mitchell
Copy link
Contributor

We should ensure that all calls to new ArgumentException and new ArgumentNullException use one of the overloads that accept a parameter name.

Additionally, we should verify that this value is a compile-time-resolvable constant that matches one of the argument names.

Code fix providers: maybe one for each of the arguments that supplies nameof(argumentName) in the appropriate position? Other than that, I don't know of automatic fixes that could be provided.

We might also provide a code fix provider that finds constant strings and turns them into nameof operator usages, although this would probably be need to be flagged at a level less than a warning, unless we want to introduce a lot of noise to older projects.

@amanda-mitchell amanda-mitchell added the new analyzer Suggestion for a new analyzer to add label Jan 7, 2019
@amanda-mitchell amanda-mitchell changed the title ArgumentException / ArgumentNullException usage ArgumentException / ArgumentNullException / ArgumentOutOfRangeException usage Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new analyzer Suggestion for a new analyzer to add
Development

No branches or pull requests

1 participant