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
Version Used:
Visual Studio 15.3 Steps to Reproduce:
Compile the following code
usingSystem;namespaceA{publicinterfaceInterfaceA{}publicstaticclassExtensions{publicstaticvoidDoSomething<T>(thisTinstance)whereT:InterfaceA{Console.WriteLine("Do something on A");}}}namespaceB{publicinterfaceInterfaceB{}publicclassClassB:InterfaceB{}publicstaticclassExtensions{publicstaticvoidDoSomething<T>(thisTinstance)whereT:InterfaceB{Console.WriteLine("Do something on B");}}}namespaceRun{usingA;usingB;classProgram{staticvoidMain(string[]args){Console.WriteLine("Hello World!");ClassBclassB=newClassB();InterfaceBinterfaceB=classB;classB.DoSomething();interfaceB.DoSomething();}}}
Expected Behavior:
Does generic constraint shouldn't be taking in account at a moment and discard the not wrong extension method from the candidate list ?
Actual Behavior:
Compiler error
error CS0121: The call is ambiguous between the following methods or properties: 'A.Extensions.DoSomething<T>(T)' and 'B.Extensions.DoSomething<T>(T)'
The text was updated successfully, but these errors were encountered:
Version Used:
Visual Studio 15.3
Steps to Reproduce:
Compile the following code
Expected Behavior:
Does generic constraint shouldn't be taking in account at a moment and discard the not wrong extension method from the candidate list ?
Actual Behavior:
Compiler error
The text was updated successfully, but these errors were encountered: