Code Rush Vs. ReSharper

iStock_ Shrugging Man Medium Its funny how sometimes there are pairs of products that contend for “best” and yet seem to be so evenly matched that the decision is often arbitrary, a pick made based on what your friends use, what you used first, which commercial (or Evangelist) is better.  Some classics come to mind

  • Coke v Pepsi
  • Parallels v Fusion
  • Starbucks v Pete’s

None of that prevents adherents from a total conviction that whatever product they happen to use is far superior (see cognitive dissonance), but I’ve never been able to detect much difference.

There are times, however, when we are confronted with a choice between two products where the choice is consequential.  This is especially true if the investment in learning how to use one makes converting to the other painful, if the product will be critical in your life and especially if your sense of self is tied up in your choice.  We see this very clearly with the Mac v PC choice, the C# v. VB.Net choice and so forth.

My dilemma is with CodeRush v ReSharper.[1] They meet all the criteria: the learning curve on either makes switching to the other non-trivial; they are critical in my work and I certainly don’t want to choose the one that all the hip geeks sneer at.

What Are These Things?

Let’s start with what they have in common.  Both are add-ins to Visual Studio and both greatly enhance your productivity and the quality of your code. They do this in three key ways (and lots of other smaller ways)

  • Making it easy to identify areas of the code that are outside your own coding guidelines
  • Making it very easy to refactor your code
  • Providing “Intellisense on steroids” reducing the amount of typing you have to do.

CodeRush is a DevExpress product, and their front page says,

For Developers, CodeRush for Visual Studio® .NET will help you create sophisticated code blocks in seconds and extend code templates instantly. CodeRush will complete identifiers as you type and expand or contract selections logically. With CodeRush, you will be able to instantly place selected code inside Try/Catch blocks, Regions and your own custom wrappers with ease.

ReSharper is built by JetBrains and their front page says,

  • Continuous code quality analysis
  • Instant fixes to eliminate errors and code smells.
  • 40 solution-wide refactorings to safely change your code base
  • 200+ code editing helpers.
  • I’ve yet to see a comprehensive head to head review that wasn’t out of date by the time I read it, and, to be honest you won’t find one here either.

    Some of the most important distinctions I have found so far, however, are these:  [2]

    CodeRush Wins ReSharper Wins
    Refactoring – fewer key strokes Ability to apply formatting and refactoring rules all at once (one key fix)
    More refactorings Some key refactorings not in CodeRush
    Better identification of memory leaks in non-managed code More code issues reported
    Many more snippets – much less typing but you have to remember the short-cuts Better Intellisense supplement
    Terrific real-time learning, context sensitive window Possibly more focused on C# and less on non-managed code
    Better support for Unit Testing Better searching

    It’s a pretty close call. One thing that I’m hoping is that if I spend enough time in both I’ll get a better sense of which is less intrusive and which is more readily called upon when needed. These are surprisingly elusive characteristics.

    So, do you use one or the other? Do you have a clear preference and if so why?  Please, use the comments to share your thoughts and experiences.

    Footnotes

    [1] Full Disclosure: I have multiple license of each. At least one of the companies provided a free copy because I was working on an Open-Source project, at least one license was provided at an educational discount because I’m on the faculty at Brandeis University. It is very possible either or both provided free licenses before I joined Microsoft, and certainly the technical evangelists for both have been wonderfully eager to help me stay within corporate and ethical guidelines while making it easy to obtain their products.

    [2] Even Fuller Disclosure – this list is based on my observations and also comparison points from both company’s sites and in private correspondence from Gary Short, a truly terrific human being who is a DevExpress Technical Evangelist.  Interestingly, the most balanced evaluation was Gary’s!

    About Jesse Liberty

    Jesse Liberty has three decades of experience writing and delivering software projects and is the author of 2 dozen books and a couple dozen online courses. His latest book, Building APIs with .NET will be released early in 2025. Liberty is a Senior SW Engineer for CNH and he was a Senior Technical Evangelist for Microsoft, a Distinguished Software Engineer for AT&T, a VP for Information Services for Citibank and a Software Architect for PBS. He is a Microsoft MVP.
    This entry was posted in Tools and Utilities and tagged , . Bookmark the permalink.

    65 Responses to Code Rush Vs. ReSharper

    1. Hello,I read your new stuff named “Code Rush Vs. ReSharper | Jesse Liberty” on a regular basis.Your writing style is awesome, keep up the good work! And you can look our website about powerful love spells.

    2. I am a absolute CodeRush fan. I tried to use Resharper several times but failed to get along with it. One of the features of CodeRush that I use extensively is its templates (rt+SPACE and it becomes ‘return true;’) and Resharper doesn’t have such a feature. I admit that search functionality in Resharper is much better.
      But I think everyone loves the tool that he/she started to use first. I say that from a lot of blog posts that I read on recommending one or another.

    3. Do you mind if I quote a couple of your articles as long as I provide credit and sources back to your weblog?
      My website is in the very same area of interest as yours and my visitors would genuinely benefit
      from some of the information you provide here.
      Please let me know if this alright with you. Appreciate it!

    4. Hugh says:

      ReSharper is simply not a tool that I would trust when developing serious software I’m afraid. It reports false errors sometimes that suggest it misunderstands the C# language at a fundamental level.

      For example it reported (as an error) “Cannot declare a pointer to a non-unmanaged type” for some code that compiles and runs fine under VS 2008, VS 2010 and VS 2012.

      In this case the analyzer failed to see that the pointers were being used within a “fixed” block and so it was completely legal C#.

      Another is an error reported about the use of the “??” operator, it claimed that the left hand operand can never be null but this was untrue (and could never be deduced anyway by any static analysis).

      Entrusting costly (and often already tested) source code to such a tool with these kinds of fundamental weaknesses in its semantic analysis is just too big a risk in my view.

      I can’t speak for the other products, I simply tried ReSharper a few weeks ago and applied to some pretty complex real-time stuff I have here and was pretty shocked at the laxity I saw.

      Hugh

      • MK says:

        Hugh, I had similar impression to you several times, and blamed R# for either misunderstanding or overprotectionism..

        And well.. it always turned out I had to apologize it afterwards… R# is always right, and if you dont believe you’ll learn that from production one day 😀 That’s my experience so far.

        Price is fair IMO; However. I’d love to see it working better with huge, complicated solutions.

      • Tycho Henzen says:

        I would be quite interested to see the specific code that caused ReSharper to complain about your use of pointers, ReSharper also has fully customizable “severeness” levels, so an error from ReSharper may not necessarily mean it’s uncompileable code, but it might flag things that are VERY bad practice as errors to indicate it’s severity, again, the pointer matter is very context-sensitive, and i would need to see a code example to know if it makes sense for it to flag that.

        for instance, the following code causes that same error completely accurately:

        class A
        {
        public int Test;
        }
        class B
        {
        private A _test;
        unsafe void test()
        {
        _test = new A();
        fixed (A* b = _test)
        {
        *b.Test = *b.Test + 1;
        }
        }

        a functioning replacement would be


        class A
        {
        public int Test; //contents not relevant, but a is a nullable type
        }
        class B
        {
        private A _test;
        unsafe void Test()
        {
        _test = new A();
        fixed (int* b = &_test.Test)
        {
        *b = *b + 1;
        }
        }
        }

        and on the ?? operator, it’s very possible for a nullable variable to never be null, SPECIFICALLY from static code analysis, consider the following code:


        class A
        {
        private int _test; //contents not relevant, but a is a nullable type
        }
        class B
        {
        private A test;
        A GetTest()
        {
        ...do stuff...
        test = new A();
        ...do more stuff...
        return test ?? (test = new A()); // ?? operator checks for null, and test is a nullable value, but because test has been unconditionally assigned at some other time within the same scope it can never be null at this position in your code
        }
        }

        finally, ReSharper as a tool, is somewhat like a car navigation system, it will do a LOT for you, but you still have to use your brains now and then to evaluate what a good way to solve the issue is, and it might well not be an issue, in which case it’s quite easy to tell ReSharper to shut up about the issue, as it can generate a list of annotations you can use to flag things that would normally cause errors or warnings to be intentional.

        Unity3d, for example, uses functions like void Update() to manage it’s program flow, these functions aren’t called anywhere within your source code, so ReSharper notes them as functions that are never called, and wants to remove them, but you as a developer know this is how the function is intended to work, so you can flag it as [usedImplicitly] and the warning disappears, even giving future developers some immediate insight into the structure of the code, because the annotation itself indicates that the code isn’t referenced anywhere, and that some form of external code that’s added during compilation, but that isn’t part of the .net CLR (probably some framework you’re using) does use the code (likely via reflection or something similar)

    Comments are closed.