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

RCS1256: Allow null-checks on virtual method overrides #1456

Open
RenderMichael opened this issue May 6, 2024 · 0 comments
Open

RCS1256: Allow null-checks on virtual method overrides #1456

RenderMichael opened this issue May 6, 2024 · 0 comments

Comments

@RenderMichael
Copy link

Product and Version Used:
Roslynator 4.12.2

Steps to Reproduce:

using System;

class Base
{
    protected virtual void M(string? str) { }
}

class Derived : Base
{
    protected override void M(string? str)
    {
        ArgumentNullException.ThrowIfNull(str);
        // process str
    }
}

Actual Behavior:
Warns on ArgumentNullException.ThrowIfNull(str);

Expected Behavior:
In my opinion, no warning - we're locked into the nullable argument because of the virtual method.

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

No branches or pull requests

1 participant