Best-kept secret in Xamarin Studio: source code analysis similar to Resharper

If you've ever used ReSharper (or even CodeRush from DevExpress) for Visual Studio, you know just how useful these development productivity tools are, and how you often wonder how you ever got along without them.

Now, if you're like me and you've had the pleasure of diving into mobile development with Xamarin, you may have quickly recoiled in horror, realizing that "Oh shite...I don't get to use Visual Studio. Which means I don't get to use ReSharper! Gaaaahhh!!!" Now, of course, this is not entirely true because Xamarin does indeed have Visual Studio integration. However, it costs $999 per developer per platform per year!!!

I love Xamarin, I really do. In fact, you might call me a fan boi (my phones and laptops are proudly adorned with Xamarin stickers). But that business licensing price is effing expensive for any hobbyist developer. Of course, if you're forking over a bunch of cash for Visual Studio, you probably don't care about the added cost for Xamarin integration. But, if you're like me and you have Indie licenses for Xamarin that you paid for out of your own pocket, you simply do not get access to the Visual Studio integration. Which consequently means that you also don't get access to sweet development productivity tools, like ReSharper and CodeRush. Eff.

If you're not using Visual Studio for Xamarin development, then you're using Xamarin Studio (formerly MonoDevelop). Now, a lot of people like to knock Xamarin Studio, mostly because it feels foreign to them compared to Visual Studio, but also because it doesn't offer all the same bells and whistles. But you know what? I could really do without all the bells and whistles. In fact, Xamarin Studio is my Xamarin IDE of choice. This probably has a lot to do with the fact that there was no other way to do Xamarin development when I started with MonoTouch (and MonoDevelop) back in 2011, and so I've grown quite accustomed to it. But I'm definitely not alone. If you're an indie developer doing Xamarin work, then you're using Xamarin Studio. And you know what? It's really not that bad. In fact, I really really like it, and I don't even try to do Xamarin development in Visual Studio. (To be fair, I have tried it at my day job where we have all the fancy licenses, but I still use Xamarin Studio. It's just more comfortable, especially for iOS development.)

Now, to the point of this blog post:_

As it turns out, a lot of that sweet developer productivity goodness that you enjoy with ReSharper and CodeRush..._is built right into Xamarin Studio. No bullocks. Here's how you enable it:

Enable source analysis in Xamarin Studio

What this gives you is a lot of really great on-the-fly analysis of your source files. It works on all open files! No need to run the analysis...it's always running!

Examples:

Remove redundant using directives:
Remove redundant using directives

Change to readonly:
To readonly

Convert to lambda:
Convert to lambda

Replace with method group:
Replace with method group

And as you can see here, the scroll bar indicates where the source analysis items exist in the file:

Indicators in scroll bar

Is it JUST as good as ReSharper or CodeRush? No, it's not. But it definitely helps in identifying areas in your source that can be more efficient, clean, and readable. If you're a Xamarin dev using Xamarin Studio, turn it on NOW!

comments powered by Disqus