-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Harden SignatureEquals nullability checks #53052
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
Conversation
@@ -108,8 +108,13 @@ public Endpoint(IInvocationOperation operation, WellKnownTypes wellKnownTypes, S | |||
|
|||
public static bool SignatureEquals(Endpoint a, Endpoint b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the parameters be nullable?
public static bool SignatureEquals(Endpoint a, Endpoint b) | |
public static bool SignatureEquals(Endpoint? a, Endpoint? b) |
@@ -108,8 +108,13 @@ public Endpoint(IInvocationOperation operation, WellKnownTypes wellKnownTypes, S | |||
|
|||
public static bool SignatureEquals(Endpoint a, Endpoint b) | |||
{ | |||
if (a == null || b == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handle both being null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could do so by returning ReferenceEquals(a, b)
@@ -108,8 +108,13 @@ public Endpoint(IInvocationOperation operation, WellKnownTypes wellKnownTypes, S | |||
|
|||
public static bool SignatureEquals(Endpoint a, Endpoint b) | |||
{ | |||
if (a == null || b == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (a == null || b == null) | |
if (a == null && b == null) | |
{ | |
return true; | |
} | |
if (a == null || b == null) |
Unit tests? |
Closes #52492