protected override void OnTextInput(TextCompositionEventArgs e)
{
    e.Handled = true;
    DoSomething(e.Text);
}

If I check for null, CA is happy, but ReSharper says that the null check will always be false. I'm not sure who is more trust-worthy here... it seems like a bug in ReSharper possibly since, in theory, someone could extend from my class and call this method directly passing in null. But I guess I'm just looking to double check which tool is correct and which one has the bug in it.

有帮助吗?

解决方案

it seems like a bug in ReSharper possibly since, in theory, someone could extend from my class and call this method directly passing in null.

As unlikely as it may seem, this is entirely possible. I would err on the side of caution and follow the Code Analysis recommendation of doing a null check.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top