Resharper 2018.1, Code Cleanup, and Extension Methods being converted to static
We just upgraded to ReSharper 2018.1, and now when running Code Cleanup, if "Optimize 'using' Directives" is checked, it converts extension methods to qualified static method calls (which it did not do with the previous version we were using with the same cleanup configuration).
It seems this was a problem back in 2011, and apparently fixed:
Is this a known issue and are there plans to address it?
Thanks,
Louis
Please sign in to leave a comment.
Hello Louis!
Thank you for contacting us.
I've tried to reproduce the problem and had no luck
Could you please install the latest ReSharper 2018.1.2 and check if the problem is reproduced.
If it's still relevant some code sample demonstrating the issue will be very helpful.
Thank you.
We are still seeing this in 2018.2.3.
Hello Gavin!
Thank you for the feedback.
Could you please check if the following option is enabled - ReSharper | Options | Code Editing | C# | Code Style | Reference qualification | Prefer fully qualified references.
Thank you.
Hi Angelina, thanks for your response.
Yes, that option is selected. That's a deliberate choice - we want fully qualified references except in the case of extension methods. The existence of a separate option to control extension methods strongly suggests that's how it should work. So does the wording: "Prefer fully qualified references" is weaker than "Convert static method invocation to extension method call".
Hello Gavin!
Fair point.
I've added your comment to correspondent issue - https://youtrack.jetbrains.com/issue/RSRP-329616.
You are welcome to comment or vote for it as well.
Thank you.