I decided to give the full CodeRush + Resharper! suite a go, with a view to upgrading from the free (and excellent) CodeRush Express Visual Studio 2010 plugin.
I really like CRX, to the extent that in the past I have explicitly removed an install of Resharper because it interfered with CRX too much. So, I was hoping that CR would be more of the same sort of goodness that CR has.
Well, it has lots of things in it, some that I like a lot – but also some things that I’m not a big fan of and that I think still need some work on.
Unfortunately when I tried running it last week I completely gave up on it after an hour or so, and ended up uninstalling it completely. I then caught my breath and decided to give it another go…
As I’m writing this over a period of time, my intention is to give feedback on it over the coming days / weeks as I get to grips with it more and more. So, without further ado, here are my initial thoughts a few days later after install: –
There are a multitude – dozens, if not more – of new, and mostly excellent refactorings ranging from creating an “else” statement to splitting conditionals to combining return statements. And now I can also rename a class and automatically rename the associated file. As always, you need to spend some time to learn what they are and how to use them – I certainly haven’t found them all – but if you liked the ones in Code Rush Express, then you will be very happy at what is in here.
Tab to next reference
Taken out of CRX since VS2010, this is now back. Wahey!
You get a load of addition icons and such added alongside your methods, fields, properties etc. – much like the (sadly no longer free) VS10x Edit View Enhancer. These are a handy way of visually making a large class easier to navigate.
Code Metrics in the IDE
Each method can now also have a little number next to the declaration which represents a code metric e.g. cyclomatic complexity or maintainability index. A nice feature – and it would be nicer if this existed at the class level, too.
XML editor enhancements
I noticed a number of refactorings when editing XML files, such as splitting attribute declarations over multiple lines, expanding selections (as per C# with the numlock keys), and even things like underlining colour declarations in XAML with the colour itself; clicking it brings up a colour mixer – nice.
The install proceeded without a hitch (having unchecked CRX and just left CR and Resharper!) in there. However, immediately after install and starting VS, I noticed that the usual CTRL ‘ keyboard shortcut wasn’t working – I needed to restart VS again before it woke up. Not the best start.
There’s an Intellisense enhancement which sometimes tries to guess what symbol you’re trying to type. So if you have declared a variable called myFirstSetOfResults and start typing “myFi”, CodeRush will try to fill in the variable – you can press Enter and carry on, or Escape to cancel it. (This is effectively a shortcut for pressing CTRL + Space and then Enter which is built-in to Visual Studio). Unfortunately, however, CR had a habit of kicking this in whilst creating a foreach declaration e.g.
At this point CR will try to finish off this declaration as well – when you obviously want to enter a new, unique variable name for the temporary variable. It confused me, and shouldn’t have been popping up at this point in code. So far I’ve had mixed feelings about this feature – it’s sometimes handy, other times it just got in my way.
I tried this for about an hour and then gave up. The results window looks nice – sort of like the Resharper one, with a split window for the failed tests and the stack trace etc.. However, the default behaviours are somewhat annoying if you’re used to the VS test runner: double clicking does not go to the test; it reruns it.
It also adds some nice artefacts to the VS IDE – alongside each test (in code) it shows an icon whether it passed or not on the last run, and you can mouse over it to get more details of the test. This is handy (especially if you can bind it to a keyboard shortcut). However, I ended up stopping using the runner for a couple of small but annoying reasons. Firstly, every time I ran a unit test VS decided to do the “ping” error sound – annoying; secondly, and more importantly, CR didn’t always rebuild my assemblies after I made code changes so unit tests were failing even though I’d fixed my code – so I needed to keep manually doing a rebuild and then running the unit tests.
Maybe I’ll try this again in a week or so.
Find All References Dialog
The standard “find all references” dialog has been replaced by a new CR one. I didn’t like it and removed it almost immediately – primarily because they’ve only replaced half of it i.e. SHIFT + F12 goes to the show references dialog, but F8 doesn’t cycle through each reference in the code window. This is something that I simply could not understand – why replace just half of the use case by default? As it stands, the new dialog (which seems to be a sort of find all references / call hierarchy hybrid view) ends up removing functionality because of the lack of this shortcut.
You get a massive “Build Failed” banner on the screen when you try a build via the test runner and it fails. I ask you, what exactly is the point of this? It stays on screen for about 5 seconds and then disappears. I found it extremely annoying. Why not just do the usual display of the error dialog tool window? Yes, you can remove it – but why put it there in the first place.
This has been the most annoying part of the install so far. CR replaces your keyboard shortcuts with its own, without first bothering to check if they are in use. For example, if you have the VS Productivity Power Tools installed, it comes with a useful “find” feature which has the shortcut CTRL + 3. CR replaces this with a “create region” enhancement – which is a nice feature, but it’s not what I wanted when I hit CTRL + 3. There were a few of these scattered throughout and really drove me mad, as I had to go through the overly-complicated options screen to remove the shortcut from CodeRush. CR simply should not be replacing keyboard shortcuts with anything other than something that does the same as what it did before (e.g. as they have done with the F2 rename refactor), or not doing anything at all.
This is similar to one of the primary reasons why I didn’t like Resharper – it contained a non-standard set of keyboard shortcuts that ended up slowing me down, and I felt like I was learning something that would mean I would end up relying on them and not being able to code effectively without them.
Live Code Analysis
This is a good idea in principle, similar to the resharper one – although I need to find out what the keyboard shortcut for it is – but there were a few things that I didn’t like. Firstly, it shows unused declarations in grey – a good idea, except it did it on the object and event args of event handler methods as well, which are often ignored anyway. And if those event handlers are linked up in XAML, at first the IDE did not detect this and showed the entire method signature in grey – making me think that it was not being used. Only after I had saved and waited some not-insignificant period of time did the code analysis thread “catch up” and figure it out. I found this quite annoying and didn’t really help me because it was fairly slow, and I ended up disabling it.
My initial thought was “wow, there’s a lot in here!”. That’s a good thing – but for someone like me that’s been using CRX religiously for 18 months or more, I got a lot more than I bargained for. I thought I’d have a load more refactorings, and some other bits and pieces, and bobs your uncle – an easy upgrade. Instead, I also got the code analysis, unit test runner and other IDE enhancements, new keyboard shortcuts etc., and I’ve ended up disabled a few of the “extra” features (at least for now) because they were simply overloading me with new things. I plan to try them out in isolation in order to evaluate them properly.
I should point out that I got some good guidance on upgrading to CodeRush from CodeRushExpress from Rory Becker (thanks Rory!), which, once I’d read them, did make my life a little easier.