WinForms event handler possible NullReferenceException
I have an event handler that is used by multiple controls. within the handler is a series of ifs checking which control is the "sender" (as shown below).
else if (sender == socialSecurityNo) CremationSSN.Text = socialSecurityNo.Text; else if (sender == CremationSSN) socialSecurityNo.Text = CremationSSN.Text;
Why is ReSharper telling in the first if that "socialSecurityNo" is possibly null (it's obviously not since it's the sender). Same thing with the second if - it's highlight with a blue squiggle and listed as possibly null.
Please sign in to leave a comment.