-
Notifications
You must be signed in to change notification settings - Fork 364
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
Properties that are explicit interface implementations are not sorted consistently #315
Comments
Thanks for reporting the issue and providing a code sample, I have reproduced it. I agree the reorganization order should be stable and not require multiple runs to get to that state. |
Hope I'm not hijacking with another feature request, but when implementing a fix would it be possible to have the option to have explicit interfaces methods/properties positioned after all public methods/properties - it might not be everyone's taste so that's why it would be good to have it optional? |
@samcragg Do you know if there is any standard for how explicit interface implementations should be treated? They are a bit of an oddball in that they don't have a declared access level but infer from their interface (if I remember correctly). I took a quick peek at StyleCop rules but didn't see anything listed. |
I don't think there's a standard - they just get treated as normal public properties/methods (there was an issue for the StyleCop analyser regarding this). However, a personal preference (which I'm not alone with) is to have them after the end of the public stuff, i.e.
Like I said, it might be something that could be snuck in when fixing the ordering issue? If not I'd be happy to submit a pull request if you think the feature would be beneficial? |
Makes sense, thanks for the references. Pull requests absolutely welcome! |
@samcragg Is this still an issue following your pull request? |
I've been using the CI build (10.1.014) on my machine and it's been working fine for me, no issues with the order of the explicit interfaces. I've just tried the reproduction steps and can verify that the two explicit interface properties are left in a consistent order when reorganising multiple times (the public one goes first then the two explicit interface properties are left in the order they were in the file, as they have the same name, however, they stay in that order and no longer "dance around" like reported) |
Awesome, thanks for confirming. I'll mark this as resolved to close out with the next release. :) |
Environment
Description
Properties with the same name, some of which are explicit interface implementations, are not sorted consistently. This causes occasional merge issues when the properties are re-ordered in different ways in different branches.
Steps to recreate
Current behavior
Same-named properties (allowed by explicit interface implementation) sort differently based on initial position.
Start
Reorganize 1
Reorganize 2
Reorganize 3
Expected behavior
Same-named properties should sort in a single, stable order.
Suggestion: Properties that are implicit implementations should be sorted first, with explicit implementations after, sorted by interface full name or other stable value.
The text was updated successfully, but these errors were encountered: