Bug Report T428544
Visible to All Users

Refactorings - Renaming a namespace alias renames the namespace instead

created 8 years ago

When using the rename tool in CodeRush for Roslyn and renaming a namespace alias "MyAlias" below, such as:

using MyAlias = My.Other.NameSpace.DontTouchThis.OhNoes

It will rename the aliased namespace that the alias refers to throughout the entire solution instead of only renaming the alias. (It does at least rename the alias, too.)

CodeRush Classic works fine. CR for Roslyn screws everything up by changing my whole solution. :(

Show previous comments (1)

    Here's the screencast of me going into CR for Roslyn options with CR Classic disabled and showing you the hotkey I bound to it. It does exist, but it's just not a default binding. I had to create a hotkey, then I picked the command "Rename" to tie it to.

    I missed the fact that it didn't correctly identify the Alias as the item I wanted to rename. When I made the screencast I noticed that it popped the renamer onto the target aliased namespace instead of the actual alias even though I had my edit caret in the alias. It's still a bug, just turns out that it's not the bug I thought it was because I use the renamer so often that I just start typing.

    I don't like Popups when renaming. It breaks my flow. That's why I'm using 3rd party refactoring tools instead of the ones built into VS, after all.

    Enabling CR Classic and doing it works as I would expect (I just did it again to verify I'm not talking out of my butt). I've done it tons of times which is why I'd just started typing when I used CR for Roslyn. Unfortunately that had broad impact because I'd happened to modify an "alias" for a namespace I used all over my very large solution. Had I just started working, not a problem and I would have just discarded changes en masse. But I had already modified many files so I had to go through each one individually and discard line by line.

      I also don't use the quick action popup for Rename. CR Classic has slow action popup instead of quick action popup so I made sure I bypassed it as often as I could by just binding hotkeys to the options I used most frequently.

      DevExpress Support Team 8 years ago

        Jason, thank you for the detailed description.
        We're concerned to hear that you're facing this problem. Currently, we're able to reproduce the issue and as soon as we find an appropriate solution, we will update this thread. Please bear with us, your patience is greatly appreciated.

        Answers approved by DevExpress Support

        created 8 years ago

        Hi Jason,
        We have deeply examined the issue and concluded that the "Rename" command you bound to the "Ctrl+R" shortcut is only for developing and debugging purposes.
        Its functionality only vaguely resembles the "Rename" refactoring. We would like to apologize for this misunderstanding. You shouldn't see it in the release version of CodeRush. We will remove it from the package soon.
        Since CodeRush for Roslyn doesn't have its own Rename refactoring, we would recommend you assign "Ctrl+R" to Visual Studio's "Refactor.Rename" command (see the attached screenshot). This command is absent in our command list, so type its name in the text box manually.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.