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

Add analyzer and code fix provider for Requires.NotNull/Range #21

Open
AArnott opened this issue Aug 5, 2018 · 1 comment
Open

Add analyzer and code fix provider for Requires.NotNull/Range #21

AArnott opened this issue Aug 5, 2018 · 1 comment

Comments

@AArnott
Copy link
Member

AArnott commented Aug 5, 2018

When the caret is positioned on a parameter declaration for a reference type, we should offer a code fix to add:

Requires.NotNull(p1, nameof(p1));

Similarly, when positioned on an integer/float parameter declaration, we can offer a code fix to add:

Requires.Range(p1 >= 0, nameof(p1));
@drewnoakes
Copy link
Member

Additionally, flag forms such as this to library calls:

if (arg is null)
{
    throw new ArgumentNullException(nameof(arg));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants