-
Notifications
You must be signed in to change notification settings - Fork 104
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
error CS0111: Type 'SomeType' already defines a member called 'Equals' with the same parameter types #864
Comments
We should investigate the built-in support behavior in .NET Native/.NET Core to see what they do |
With existing built-in .NET support for WinRT, default behavior for ToString, Equals(Object), and GetHashCode methods is provided for C# WinRT components. According to these docs, Windows Runtime classes that are written in C# or Visual Basic can override the Equals(Object) method overload. @Scottj1s - is it possible to define/override the Equals method from a C++/WinRT component that is projected into C#/.NET 5? |
Looking into the existing .NET Native support: If we have a C++/WinRT component with the following definition:
Consuming this component from a .NET Native (UWP) C# application, I see two Equals methods (overloaded): public bool Equals(Class c); // in my RuntimeComponent
public virtual bool Equals(Object obj); // in System.Runtime - this method also appears if I don't define Equals in my C++/WinRT component |
CsWinRT should ensure the IEquatable pattern of 5 methods is enforced, picking up any methods that the runtime component implements. |
I just ran into this problem 😭. |
Same problem here. |
Describe the bug
CsWinRT generates duplicate Equals methods if the underlying type in the WInMD already has an Equals() method with itself as the type parameter
To Reproduce
Create a C++WinRT component with a type that has an Equals method with itself as the equator. For example:
Pass the WinMD to CsWinRT.
Expected behavior
No error.
Version Info
CsWinRT 1.2.6
The text was updated successfully, but these errors were encountered: