Working with Resharper’s External Annotation XML Files

Resharper 4.0 has external annotation XML files that you can create to give Resharper more information about your code.  For example, you can tell Resharper that a particular method does not accept a null argument.  For example, the following method does not accept a null argument: using System;   namespace Utility {     public static class Text     {         public static int GetLength(String text)         {             if (text == null) throw new ArgumentNullException(“text”);             return text.Length;         }     } } An external annotation file can be created to inform Resharper … Continue reading Working with Resharper’s External Annotation XML Files

Comparing CodeRush Refactor! Pro and Resharper 4, part 1 or N — first glance.

Metadata view of code in referenced assembliesThis is a big one for me.  For whatever reason, Refactor 4 (and prior) completely disables this and sends you to the Object Browser instead.   You get metadata view with CodeRush Refactor! Pro.  Keyboard layoutAs you might imagine, CodeRush Refactor! Pro and Resharper had completely different keyboard layouts.  So, if you’re used to R# then Refactor! Pro will take a bit of getting used to. One thing I don’t like with the default Refactor! Pro keyboard layout, is they’ve replaced Ctrl-. with Quick Navigation.  I use Ctrl-. (instead of Shift-Alt-F10 to get at the … Continue reading Comparing CodeRush Refactor! Pro and Resharper 4, part 1 or N — first glance.

Resharper 4.0 EAP Settings and Installing Latest Build

The 4.0 EAP tends to do a full uninstall before installing (it’s pre-beta, pre-alpha even; so it’s no wonder). This tends to blow away your settings changes.  If that’s a pain point for you, the settings are stored in “%userprofile%\application data\jetbrains\resharper\v4.0\vs9.0”.  There are a couple of xml files in there that store your settings.  Before you upgrade to the latest build, just copy those to another directory.  It’s very likely that the format of these files has changed since the last build so copying the backups over the new version could possibly make Resharper to blow-up.  So, use with caution.

Resharper Isn’t Always Smart

I was writing some code today, essentially like this: public class MyClass {     private int value;     public MyClass(int value)     {         this.value = value;     }     public static bool operator==(MyClass left, MyClass right)     {         return left.value == right.value;     }       public static bool operator !=(MyClass left, MyClass right)     {         return !(left == right);     } }     //…     MyClass myClass1 = new MyClass(1);     MyClass myClass2 = new MyClass(1);     if((Object)myClass1 != (Object)myClass2) // “Type cast is reundant”     {         Console.WriteLine(“not equal”);     } … Continue reading Resharper Isn’t Always Smart