Skip to content

Add namespace and assembly check before interception #51243

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

Merged
merged 2 commits into from
Oct 10, 2023

Conversation

captainsafia
Copy link
Member

Closes #51233

@ghost ghost added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Oct 9, 2023

public static class EndpointRouteBuilderExtensions
{
public static IServiceProvider Map(this IServiceProvider app, int id, Delegate requestDelegate)
Copy link
Member

Choose a reason for hiding this comment

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

Another nit: Should use the exact same signature as Map

public static IEndpointConventionBuilder Map(
        this IEndpointRouteBuilder endpoints,
        RoutePattern pattern,
        RequestDelegate requestDelegate)

Copy link
Member Author

Choose a reason for hiding this comment

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

Based on the overload resolution rules for extension methods, the compiler will bind to the methods defined in the framework if they have the same signature. I did update the tests to include a scenario with extension methods targeting IEndpointRouteBuilder and a different type for the second parameter.

@captainsafia captainsafia merged commit f9121bc into main Oct 10, 2023
@captainsafia captainsafia deleted the safia/fix-interceiption branch October 10, 2023 21:53
@ghost ghost added this to the 9.0-preview1 milestone Oct 10, 2023
@captainsafia
Copy link
Member Author

/backport to release/8.0

@github-actions
Copy link
Contributor

Started backporting to release/8.0: https://github.com/dotnet/aspnetcore/actions/runs/6475214573

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RequestDelegateGenerator intercepts incorrect methods
2 participants