You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[MethodDataSource] Arguments that fit two overloads equally: source-gen picks the first, reflection throws AmbiguousMatchException, no analyzer diagnostic #7175
Found while extending the [MethodDataSource] overload parity table in #7143.
What happens
When the Arguments of a [MethodDataSource] fit two overloads equally well, and neither overload's parameter types are more specific than the other's, the two modes behave differently, and the analyzer reports nothing:
Source-generated mode: passes. The generator keeps the first declared overload (Tie(string, IComparable)).
Reflection mode (--reflection): fails with AmbiguousMatchException: Ambiguous match found for '... Tie(System.String, System.IComparable)', from the binder in MethodDataSourceAttribute.ResolveDataSourceMethod.
The source-generated behaviour is the same on main, which always called the first member with the name.
Expected
Both modes should behave the same. The simplest fix is probably an analyzer error for Arguments that fit more than one overload equally well, the same way C# reports CS0121 for an ambiguous call. Then neither mode reaches the runtime difference.
Activity
feat(analyzers): report MethodDataSource Arguments that fit two overl…