dotnet / dotnet/aspnetcore

Support discovering `TryParse` and `BindAsync` from extension members

Open
#61,799 0 comments 0 reactions 0 assignees View on GitHub
area-minimal feature-rdf feature-rdg
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

Follow-up to https://github.com/dotnet/csharplang/discussions/8696#discussioncomment-13042393.

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.