Thursday, May 2, 2013

Resharper 8 EAP - New Features

Technology tools and components providers have learnt that involvement of community from the very early part of development process is very critical for a successful product. Microsoft now has Community Technology Preview (CTP) versions in order to bring community on board as the features are being added. Based on the community feedback the features are tweaked and improved. There is also user voice where you can add the features you want. You can also vote on the features entered by other community members. It provides a place for stake holders to give ideas about new features or improvements about other features. The example user voice pages can be found for Visual Studio and Windows Phone. You can also use connect page to submit bugs and suggestions for existing Microsoft Products. This includes us, as developers, being in complete product life cycle. Agile helps!!!

Jet Brains [the provider of Resharper] has a similar program to include developers as the features are being added to their products. They have named it Early Access Program [EAP]. I don't know when they started this but I used the first EAP version for dotPeek. Many of my friends migrated to it when RedGate put a price tag on Reflector.

Resharper 8 is still in EAP program. There is a build every 10-15 days with additional / improved / fixed features. You can download and play with it. For you it makes it easier for you to transition when the tool is out in production. If there is a defect then your feedback helps JetBrains fix it. In this post I wanted to discuss about the exciting new features that I can see myself depending on a lot when the product is out. The nightly build of Resharper 8 EAP version can be downloaded from here:

Once downloaded, the EAP version can be installed on the machine with administrator's rights. The supported versions which couldn't be found on the machine are just grayed out. Since I already have Visual Studio 2012 on my machine now, you can see that it is only providing me the option to select that visual studio version.

Resharper Extension Manager for Resharper Plugins
Resharper 8 is introducing a new mechanism for releasing and managing plugins through Extension Manager. This is similar to Extension and Updates feature in Visual Studio. Since resharper is itself a Visual Studio Extension, the name Extension Manager can be confusing for some. People might think that resharper has provided a new way to manage those extensions downloaded from Visual Studio or any custom Extensions & Updates gallery. The Extension Manager is supposed to manage Resharper Plugins. You can find it in Resharper Menu.

It has a very similar view as Visual Studio Extension & Updates Dialog. There are three tabs to search an online or custom plugins gallery. You can see the list of installed plugins and uninstall them. If there is an update to an already installed plugin, it can be found in Updates tab. These are the similar tab to Visual Studio Extensions & Updates dialog.

The extension galleries can be configured through Resharper's options. If you select Settings in the above dialog then it just opens up the Options dialog with Extension Manager settings selected. You can also open the same dialog from Resharper -> Option in main menu. Here we can add, update or remove an already configured gallery. We can also disable a gallery, which can be enabled again if you want.

As discussed above, the new Extension Manager can be used to install and uninstall a plugin. The feature also supports disabling a plugin. The configuration is in the Plugins tab in the same Options dialog. You can also find the other details about a plugin here including its version number.

Please remember that these plugins are provided by community and they can have their own license terms. You can also create your own plugin and host it on JetBrain's plugin store. There are currently only two stable plugins here. I don't know how costing would work here. I really liked that these plugins can have their own dependencies.

Assembly Explorer
It is very natural for a product to atleast provide those required features that a competitor provides. The products then add extra useful features to gain competitive edge. You can find the same pattern in all markets including smart phones. Since RedGate's Reflector integrates with Visual Studio, JetBrain also needed to included its assembly exploring tool into visual studio. dotPeek is resharper's pet to explore an assembly. The same feature are added in Resharper 8 EAP in the form of Assembly Explorer. You can find the tool in resharper's main menu.

Assembly Explorer is provided as another tool window which can be handled like any other tabbed window in Visual Studio. This should greatly help in multi-monitor scenario. Here we can see other assembly references to determine assembly dependencies. We can also see the list of namespaces and the types contained by these namespaces. We can drill down in the tree to get the details of the members of these types. It is pretty much the same as in Object Browser. The difference is that Object Browser has a few extra sections to provide type's member's details and documentation.

Code navigation is supported by double clicking an item in Assembly Explorer. There are different options provided to support this. One of the option is to use the dotPeek decompiler engine. This is a reverse-engineering utility from JetBrains. It also supports using Code Definition window.

An assembly opened in assembly explorer can be exported to project. The option is provided in the context menu for an assembly in Assembly explorer. It seems that the same feature is being added to dotPeek 1.1 EAP. So the limitations are same. It can only be exported in to a C# project.

You can provide the following settings for the new project. Once a project is already exported, it allows to use and open the already exported project. You can also create a new solution file and open the project in Visual Studio.

The list of assemblies currently loaded form a session. This can be saved to load the same session in the future. The list is exported as dotPeek assembly list (dpl) file.

I think this is a great feature but this can be improved by providing support in additional contexts. A user should be able to open assembly explorer wherever he can select an assembly in Visual Studio. It includes Project's assembly references and Object Browser. An extra context menu item can be provided here to see the details of assembly contents. Like Object Browser, it can also support providing code documentation. It doesn't have to add them in a separate tab. As as starting point showing the documentation in tooltip should work. I can understand that introducing a new window has given JetBrain more control but these features might have been integrated with Object Browser as enhancement feature in order to build on the current knowledge and experience of developers.

Command Line Tools
Resharper 8 is expected to come up with a few command line tools. You might be wondering when it is already integrated with Visual Studio then why do we need these additional command line tools. Basically these tools are not intended to be used on developer's machine, they are provided for Continuous Integration scenarios for build machines. These tools provide the same check as we have on developer's machines. They would provide an extra defense for pre-commit checks avoiding unaccetable check-ins. The tools can be downloaded from the line provided above as a compressed file. They are not part of the installation package for Reharper 8. I am planning a separate post to discuss about command line tools in Resharper.

Supporting xUnit based Unit Tests
xUnit is yet another unit testing framework. You can install it from Nuget Pacakge Manager in your Visual Studio Test Project.

Visual Studio 2012 doesn't have any built-in support for running MSTest based unit tests. Running xUnit based unit tests would result the following in Output window.

Resharper also doesn't have any built-in support either. Running the same tests in Resharper would result in the following:

But you can add this support by using an EAP plugin for resharper. Just search for the following in the Resharper's Extension Manager as follows and install it. I needed to re-install my Visual Studio to actually start using it.

Let's see how we can use it now. Let's assume we have the simplest calculator in the world. The calculator just has one method, called Add. The method takes two operands, adds them and returns the result.

Now we need to test this in xUnit. We can add xUnit tests by decorating the test methods with Fact attribute as follows:

Now just run it using resharper. You can notice that you can run it now and the output is shown as follows:

Resharper 8 EAP has also introduce action indicators to streamline between gutter marks and bulbs. You can find it in the editor:

We can always go back to settings based on earlier version of resharper in the options dialog.

Note: This is not an exhaustive list of new features in Resharper 8 EAP. There are various other improvements. To see them all you can visit Jet Brain's blog. These are the features which caught my immediate eye and got me excited. Let's continue to explore!!!

Download Code

No comments: