Skip to content

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

Closed
wants to merge 1 commit into from
Closed

Conversation

captainsafia
Copy link
Member

Closes #52492

@ghost ghost added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Dec 29, 2023
@@ -108,8 +108,13 @@ public Endpoint(IInvocationOperation operation, WellKnownTypes wellKnownTypes, S

public static bool SignatureEquals(Endpoint a, Endpoint b)
Copy link
Member

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?

Suggested change
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle both being null?

Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (a == null || b == null)
if (a == null && b == null)
{
return true;
}
if (a == null || b == null)

@JamesNK
Copy link
Member

JamesNK commented Dec 29, 2023

Unit tests?

@ghost ghost added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Jan 5, 2024
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 13, 2024
@dotnet dotnet deleted a comment Feb 13, 2024
@dotnet-policy-service dotnet-policy-service bot added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Feb 13, 2024
@wtgodbe wtgodbe removed the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Feb 13, 2024
@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 20, 2024
@dotnet-policy-service dotnet-policy-service bot added this to the 9.0-preview2 milestone Feb 21, 2024
@captainsafia captainsafia deleted the safia/gh/52492 branch November 5, 2024 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Harden nullability checks in Endpoint.SignatureEquals
4 participants