I’ve said before that I really like ReSharper. Apart from Visual Studio itself, it’s the most valuable development tool I have. Whereas Visual Studio increases my productivity by letting me create code faster than I would with a simple text editor and command line tools, ReSharper helps me create better code. It also provides tools that make it easier to understand unfamiliar code and refactor older code to bring it up to modern standards. Altogether, I’ll agree with my friend Dennis who says that if you’re writing C# code professionally and you’re not using ReSharper, you’re probably committing malpractice.
That said, ReSharper has a few annoying features. Fortunately, most of them can be disabled or their behavior modified through options settings. I discovered one yesterday, though, that I find particularly disturbing.
Imagine you have this declaration in your code:
Func<bool> canExecute = () =>
{
// In this case, we can always execute the function because …
return true;
};
ReSharper helpfully recommends converting that into a lambda expression. Seems a reasonable thing to do. If you tell ReSharper to go ahead and make the transformation, you end up with:
Func<bool> canExecute = () => true;
That’s right, it deleted the comment! Not a good thing.
This isn’t a particular problem because I applied the transformation individually and saw the comment disappear. But if you modify the settings to automatically apply the transformation when you run Code Cleanup, you won’t see the comments being removed. I repeat: Not a good thing.
That’s unfortunate because it forces me not to use the automatic “convert to lambda expression” function in Code Cleanup. Not a deal killer, but a little annoying.