The first Visual Studio 2014 Community Technical Preview is out now and I’ve been having a bit of a play with it. One of the interesting things they’ve been talking about is using the Roslyn “compiler as a service” platform in Visual Studio for building .net code.
Live error reporting
The first thing you’ll notice when developing C# code in VS2014 is that errors are flagged without needing to build the project. Finally! I personally don’t need this feature because my code is perfect first time, but there are a bunch of handy things it can show you: That fat-fingered method name, the missing semicolon, incompatible variable types, that sort of thing.
It can also give you more important errors like “You haven’t actually implemented that interface, you ninny”. Which leads me to the next cool feature: Quick Fixes.
About 50% my work day is spent hitting
Alt-Enter on everything I can (the rest is hitting
Alt+Ins). This is Resharper’s default shortcut for Quick Fix, the magic solution to all the problems it finds in your code. Visual Studio’s Quick Fix feature works in the same way but is bound to
Ctrl+. by default. It doesn’t know about nearly as many little tricks for fixing/tidying your code as Resharper does, but it handles the most common case: adding a
A Resharper favourite of mine is adding an interface to a class, hitting quick fix, and having it generate all the missing methods and properties. Much quicker than typing it all out by hand!
The Visual Studio team don’t seem to have added any new quick fixes that I can see. This is a shame – Resharper has a whole bunch of alterations it can make to your code, like adding null checks, rewriting loops as LINQ, converting automatic properties to use a backing field, and removing redundant code. Hopefully these are features they can add in the future.
Visual Studio 2014’s refactoring tools have been spruced up a bit. Renaming a local variable is super fast, and allows you to edit the name inline instead of in a pop up box. All the usual suspects are still here: Encapsulate Field, Extract Interface, Extract Method, Remove/Reorder Parameters, and Rename. There are more that don’t seem to show up in the list of keyboard-mappable actions, like Introduce Local Variable, but I can’t find a list of them all. Hopefully these are made more discoverable in the final release; and mappable so I don’t have to hunt around in a context menu to apply them.
If you just want your code checked without having to wait for a full compile cycle, then VS2014 is right up your alley. Without any extensions installed it runs very fast, and the live compilation doesn’t seem to slow it down at all. If you aren’t using any of the other extras that Resharper gives you, then this is good news. I can’t compare the compile times directly as I don’t have VS2013 installed on the Azure VM I’m testing this on, but if a basic Azure A1 virtual machine (
1 2GHz CPU core, 1.75GB RAM, unknown hard drive specs) can compile Raygun as fast as my development machine (
4 3.4Ghz CPU cores, 32GB of RAM, SSD hard drive) then there’s probably some speed improvements in there.
In conclusion, I won’t be ditching Resharper any time soon, but the other improvements in VS2014 make it something to look forward to.
Click here for 5 useful Resharper Tips