-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Overload resolution fails in complex scenario with Delegate overloads and extension methods #55691
Comments
Fixed in #55357. |
@cston I checked that the above sample is indeed fixed using sharplab, but I noticed that a small change of specifying the parameter type brings back the same error.
This makes some sense given the PR was titled "Treat overload with Delegate parameter as not applicable if lambda delegate type cannot be inferred" and the delegate type can be inferred once we specify the parameter. But this does still seem like a bug to me. I would expect Roslyn to still prefer It seems like the implicit conversion on |
Thanks for catching this @halter73, I'll investigate. |
The ambiguity error for the second example (with explicit parameter type)
was resolved as "by design" in C# LDM-2021-08-23. |
Version Used:
Version 17.0.0 Preview 4.0 [31616.459.main]
Steps to Reproduce:
Expected Behavior:
AppBuilderExtensions.Map would be chosen by the overload resolution algorithm.
Actual Behavior:
The call is ambiguous between the following methods or properties: 'AppBuilderExtensions.Map(IAppBuilder, PathSring, Action)' and 'RouteBuilderExtensions.Map(IRouteBuilder, string, Delegate)' C:\Users\david\source\repos\ConsoleApp133\WebApplication1\Program.cs
It seems like the implicit conversion on
PathString
throws off the overload resolution completely. IfPathString
is replaced with string, it works as expected.cc @cston
The text was updated successfully, but these errors were encountered: