Skip to content

Support discovering TryParse and BindAsync from extension members #61799

@captainsafia

Description

@captainsafia

Follow-up to dotnet/csharplang#8696 (reply in thread).

ParameterBindingMethodCache only inspects methods that live on the destination type (or its base types) itself.
The two reflection probes that look for a binder are hard‑coded to call GetStaticMethodFromHierarchy(…) with the type being inspected as the search root. Because a C# extension‑member is compiled as a static method on some other helper class, it never appears in that search and therefore can’t be picked up.

We need to expand the GetStaticMethodFromHierarchy to search for implementations are defined in extension members as well.

We also have to reason through how to change the behavior in the RequestDelegateGenerator and analyzers to account for the fact that these methods can be implemented as extension members.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-rdffeature-rdg

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions