dotPeek is Back with New Early Build

December 8th, 2011 by Jura Gorohovsky

After several months of no-show, we’re relieved to provide a new early build of dotPeek — our free .NET decompiler and assembly browser.

We apologize for the considerable delay updating the tool, and we expect that as ReSharper 6.1 development is mostly coming to an end, we can now focus more on pre-release polishing of dotPeek.

Here’s the list of prominent changes in the new dotPeek early build (No. 7603)

  • Opening .dll files by double-clicking in Windows Explorer. dotPeek can now automatically register as an application that handles files with the .dll extension. (DOTP-151) To switch Windows Explorer integration on, select Tools > Options, and click Integrate with Windows Explorer under Environment | General.
  • Resource decompilation. dotPeek can now open assembly resources, including images and XML-based resources (for example, .resx or .dtd files), internally or by passing them to an external application.
  • Opening libraries in a single dotPeek instance. (DOTP-2615) If you’re used to browsing assemblies in a file manager and opening them in a decompiler from there, there’s no more annoyance caused by initializing multiple copies of dotPeek.
  • XML doc comments can be shown in decompiled code if the corresponding XML documentation file is available. (DOTP-1208) For instance, that means additional convenience when exploring .NET Framework libraries.
  • Properties window that provides basic information about assemblies and references selected in the Assembly Explorer. (DOTP-481)
  • Reference Hierarchy tool window. Based on ReSharper’s Type Hierarchy feature that is now extensible, this new tool window shows which references the current assembly has, allowing you to track down all its dependencies, and additionally showing recursive dependencies with a glyph to the right of a reference entry. If you click Referencing projects in the tool window’s toolbar, you can see which of the assemblies in your current assembly list reference the current selected assembly.
  • Drag-n-drop assemblies: You can now drag assemblies (or selections of assemblies) from Windows Explorer, and drop them into dotPeek, which adds them to dotPeek’s Assembly Explorer.
  • New command-line options including keys to switch Windows Explorer integration on/off, hide splash screen, and always open every new assembly in a new instance.
  • Other improvements including a toolbar with basic commands, configurable font in the source code view area, and a new ReSharper-like Options dialog box (work in progress). Also, dotPeek window position and state is now preserved between application launches.

For die-hard fans, here’s a selection of issues resolved for this build.

Please download the new build and try it out. As usual, you’re encouraged to report any issues you’re facing to dotPeek bug tracker.

Providing Intellisense, Navigation and more for Custom Helpers in ASP.NET MVC

December 7th, 2011 by Hadi Hariri

You probably are aware by now that as of ReSharper 5, we added first-class support for ASP.NET MVC. This included among many things, the ability to provide Intellisense, Create from usage and Navigation to built-in methods such as Controller.View or Html.ActionLink:

Navigation

Ctrl+Left Mouse Click or F12 will navigate to the corresponding View

image

or to the Action and/or Controller

image

Intellisense and Create From Usage

Ability to have Intellisense when providing Actions/Controllers

image

as well as the possibility of creating from usage

image

However, what happens when you want to use a custom function, for instance, a better ActionLink or your own View method? Did you know that you can still get all these goodies? All you need to do is use some Annotations.

Using JetBrains.Annotations

ReSharper uses annotations via the form of .NET attributes to figure out what an ASP.NET MVC View, Action or Controller is. As such, all we need to do for our custom method and extensions to leverage this, is tell ReSharper what parameter corresponds to what.

Referencing the annotations

To use ReSharper annotations, we have mainly two options (with a third one hopefully coming soon):

1. We can include the library JetBrains.Annotations.dll in our project and reference it.

2. We can copy the annotations and include it as source in our project

[3. We can use nuget install-package JetBrains.Annotations] Coming soon!

The first option is pretty simple. The DLL is located in the ReSharper installation bin folder. For the second option, we open up ReSharper | Options and select Code Annotations entry

image

select the Copy default implementation to clipboard button and paste into an empty file.

Annotating custom methods

Once we’ve completed this step, all we need to do is annotate our parameters with the correct attributes. We’re interested in 3 different attributes in particular:

  • AspMvcView which indicates the parameter is a View
  • AspMvcAction which indicates the parameter is an Action
  • AspMvcController which indicates the parameter is a Controller

Here is the header corresponding to a base controller with a custom method named ExtendedView

image

and here’s the header for a custom ActionLink

image

(the body of both methods are omitted and are not necessary to demonstrate the functionality)

As soon as we do this, ReSharper picks up these methods and offers us the same functionality that is provided for the methods that ship out of the box:

image

Notice how we still get Navigation (the underlining), Intellisense and Create from usage in our TheOnlyActionLink custom method. Its much the same for the ExtendedView method

image

That’s all there is to it.

ReSharper 6.1 Settings: DropBox and Company-wide

December 6th, 2011 by Hadi Hariri

This post is about ReSharper 6.1. For other features in ReSharper 6 (both 6.0 and 6.1), please see previous posts introducing ReSharper 6:

EAP Warning: This post is based on ReSharper 6.1 Early Access Program and some things such as screenshots and minor details might vary from the time this has been written to the time of release.

In a previous post on ReSharper 6.1 Settings, we introduced the concept of layers and covered a few scenarios when it comes to sharing of settings across solutions. In this post we’re going to cover a few more, namely: syncing settings over DropBox and providing a global setting for all projects across a company.

Syncing with DropBox

As developers we often end up working on multiple machines, whether it is that we own a desktop and laptop, or two desktops, one at work and one at home, or any other combination of scenarios, we have the need to alternate between machines. With the new layers settings in ReSharper 6.1, sharing the same settings in these cases has now become quite easy.

The idea is simple: add a new Global Layer and host the file in a DropBox folder (I’m using DropBox, but obviously you can use any other mechanism that syncs files remotely). In order to do this, we first need to export the current settings to that new file and then mount it.

1. Click ReSharper | Manage Options…

image

2. Select the Global Settings and click on Export to File. It will prompt for a filename. The idea is to place this file in a Dropbox folder. Select everything from the following screen except Housekeeping

image

It is important to note that only items that currently have non-default values will be displayed in this window. For instance, under PattersnAndTemplates, we’d see an entry of StructuredSearch if we were to have some custom patterns in the current context, as shown below

image

3. Select Add Layer | Existing File and select the file created in the previous step.

image

[Note: This screen will most likely be updated in a future release to combine the “ReSharper Global Settings” under the group header as this is a default layer that cannot be removed and therefore cannot intervene in normal operation such as priority]

We now have to repeat step 3 for each of our machines. Once we do that, the settings will automatically be loaded every time DropBox syncs.

Providing Company-Wide Settings

It should be pretty apparent that providing company-wide settings across all projects is pretty much the same as sharing via DropBox. We just need to provide a file. If we want to provide solution company-wide settings, we’d add the layer to the solution group. This would allow an alternative way of sharing settings which wouldn’t require the file to be checked in to source control.

Other operations to perform with Settings

Settings can be imported, exported, activated and deactivated (marking the checkbox or unchecking) at any point. We can also Copy To button to copy settings from one layer to another layer, making it also easy for sharing. In essence you can do pretty much anything you like now.

Why so many layers?

You might be thinking, if I could setup my settings to read from a specific file, why would I want more layers or the ability to order them in priority?. The idea with layers is that each one can add one or more configuration settings. This means that for instance a company could have a layer where only code formatting settings are defined, another layer where templates are defined and so on and so forth. When we export settings to a file as shown in two, we define which settings we want exported. We do not have to select them all like we did previously. We could for instance only choose to export Templates, and mount a layer where only these are defined. ReSharper can understand that there are different options in different layers and provides us access to them all. We don’t have to worry about this. The only thing we might need to take into account is if one layer overrides another one’s settings. That’s where the Move Up / Move Down comes in, allowing us to specify the priority.

Summary

The layers provide a lot of flexibility when it comes to sharing settings, either between two machines, a team or company-wide. Use them, abuse them. Give us your feedback.

Async CTP Support in ReSharper 6.1

November 29th, 2011 by Dmitri Nesteruk

This post is about ReSharper 6.1. For other features in ReSharper 6 (both 6.0 and 6.1), please see previous posts introducing ReSharper 6:

If there was one feature that has received ample attention in the run-up to ReSharper 6.1, it would have to be the request for async/await support. Despite the fact that this technology has not yet been finalized, community demand as well as the timely release of a preview version of Visual Studio vNext have convinced the ReSharper team to put in the effort to provide quality support for Async CTP.

And we’re not talking just about support for the keywords, either! The following is a list of some of the features that make working with the new features easy and enjoyable.

  • Keyword completion — somewhat unsurprisingly, async and await are now keywords that ReSharper knows about:
  • Smart completion supports async methods too. In the example below, ReSharper knows that an int return type is expected, and offers appropriate suggestions.
  • ReSharper enforces naming conventions for async methods. The “Async” suffix is configurable in the Options dialog.
  • When changing your methods to become async, you can correct the return type of an async method:
  • ReSharper verifies async propagation, so if you forget to decorate an await‘ing method with async, you will be reminded to do this:

    This also works in cases where the method is anonymous (i.e., a delegate or lambda expression):
  • ReSharper will also complain about the synchronous execution of async methods that do not contain any await instructions in them:
  • Finally, ReSharper comes with a set of analyses helping you ensure correct usage of async and await constructs. For example, in the screenshot below, ReSharper would complain about the fact that ref and out parameters are not permitted in an async method, as well as the fact that null is not awaitable:

Finally, async support permeates various areas of ReSharper infrastructure such as, e.g., its support in SSR (Structured Search & Replace). Overall, the async and await-related features have established themselves in the product, where they will stay and be improved upon until the technology’s eventual release.

ReSharper Settings in 6.1

November 22nd, 2011 by Hadi Hariri

This post is about ReSharper 6.1. For other features in ReSharper 6 (both 6.0 and 6.1), please see previous posts introducing ReSharper 6:

EAP Warning: This post is based on ReSharper 6.1 Early Access Program and some things such as screenshots and minor details might vary from the time this has been written to the time of release.

This is a first in a series of posts about some of the new options available in terms of settings with ReSharper 6.1.

One of ReSharper’s pain points has always been settings, specially when it comes to managing them across projects and/or teams. With ReSharper 6.0 we started to make changes to build in support for a new way to manage settings, but unfortunately due to time constraints, we could not get it done in time for the 6.0 release. It has however made it into the 6.1.

Unified Settings Storage

An important change is that all settings have been unified into a single storage mechanism. This means that when you load or save settings, they apply to everything, from code style to templates, patterns and naming conventions. This should make it easier than before where different things were stored in different places.

Settings for every scenario

Everyone has their own style and methodology of working. Some like to name their properties in a certain way, others don’t like to be explicit about their privates. Some use underscores, others don’t. Some like the var suggestions. Others despise it. We are all different.

When it comes to working together, we have to make compromises and settle in a series of settings and ways in which to work. One day, hopefully, we won’t have this limitation and it will be transparent to us, but until then we need to find a way to not only cope with it but define it.

This scenario is very apparent when working on a team, but even as a solo developer, we can still require different settings based on different factors. We can be working on private projects that follow our own standards or be part of an open source team that follows the standards for the OSS project.

We hope with ReSharper’s new settings we can try and accommodate different scenarios. Let’s cover a few of the simpler ones.

Single developer and same settings for all solutions

If you are a solo developer or like to have the same settings across every single solution, then you won’t notice much difference in how you save your settings. You access the settings using the regular ReSharper | Options dialog and once done you press the Save button

image

These are also known as ReSharper Global Settings and are stored in

%AppData%\JetBrains\ReSharper\vAny\GlobalSettingsStorage.DotSettings

making them easily accessible for backup and restore as well as persistence during upgrades.

Different private settings on different solutions

Sometimes we’d like to have different settings based on different solutions, even if we are not necessarily sharing these settings with a team. We’ve made this scenario quite simple too. Once again we open up the ReSharper | Options dialog and make the required changes. This time however, instead of clicking on the Save button, we click on Save To and select  %SolutionName% Solution  – Private where %SolutionName% varies based on the active solution

image

This will create a file called %SolutionName%.SLN.DotSettings.user in the solution folder (in our case ConsoleApplication2.SLN.DotSettings.user) which holds the settings for this particular project. It is important to note that this file should not be checked in to source control as each user would have their own specific settings and thus one would override the other. We recommend that this file be added to the list of files to ignore by the VCS (i.e. add to .gitignore).

Shared team settings

The next step is to have a series of settings shared across the team. As you can guess from the previous screenshot, this is merely just choosing the next option down when saving settings:

image

which will create a a %SolutionName%.SLN.DotSettings file in the solution folder. This file should be checked in to source control.

These cover some of the simple scenarios when it comes to settings. However, sometimes it is not that simple. Often we want to have the best of both worlds. For instance, we might like to have team settings and tweak them a little bit to our own use. That’s where ReSharper’s smart settings come in.

Combining Settings: Layers

Settings in ReSharper are like onions, they have layers, and these layers, combined with what we call internally “smart savings”, provide more flexibility when it comes to tweaking settings.

Say for instance we are using some shared settings from a team settings file checked in with the project, yet there are certain settings we’d like to change privately that only affects us. How would we do this?

Quite simple. We modify the settings we want tweaked and then save it as Solution Private. ReSharper realizes that there are different values for a setting and the layering kicks in which one layer override another one. The actual order of the layering is:

image

Private Settings currently override Solution Shared, which in turn override Global settings. As such, by tweaking the settings to our individual needs (only those required), we can override specific team settings.

[Note: Some have mentioned that this wouldn’t enforce team settings. True, it does not, and we believe in discipline versus constraint.]

Managing Options

You might have noticed that in the ReSharper menu, as well as the Options dialog there is a new entry / button labeled “Manage Options” and “Manage…” respectively. These provide access to managing the different settings layers easily as well as importing/exporting and resetting.

image

When clicking on them, we’re displayed the following dialog:

image

The dialog box lists all the different layers currently available. Out of the box, ReSharper ships with the three we’ve already discussed: Global, Private and Shared with Team. Each of these are appropriately placed in the correct Group, which also happens to be three. From this dialog box we can edit each of these as well as import and export settings.

To edit specific settings, we merely select the one we’re interested in and click on the Edit… button on the top-left corner. This opens up the regular Options dialog box for us, with a minor difference. It now displays the name of the layer we are editing:

image

This difference is also apparent in that the Save To Button is no longer present, as when clicking Save we will automatically save the layer we are editing. When we edit the settings, only those of that specific layer are updated. Everything else stays intact.

Summary

The new ReSharper settings is hopefully designed in a way which allows to not only ease the pain of sharing settings, but provide for a variety of options and maximum flexibility. In the next parts we’ll cover how to add additional layers (including storing settings on Dropbox for instance), re-order, as well as importing and exporting of old and new settings.

Important: Change of Venue for JetBrains Event in London Today

November 18th, 2011 by Jura Gorohovsky

If you’re planning to attend the JetBrians Magical Mouseless Continuous England Group Tour event today in London, please be aware that the location has changed.

The new location is 150 Minories, London EC3N 1LS

It’s only 5 minutes walk from Aldgate Tube Station, and 10 minutes walk from the old location on 45 Beech Street.

We sincerely apologize for the short notice on venue location change, and we’re looking forward to seeing you at the event!

Oredev License Raffle Winners!

November 17th, 2011 by Jura Gorohovsky

We’ve recently got home from Oredev after having a great time talking with developers from all around Northern Europe, drawing pictures and shaping the geek fashion. This is one terrific conference and we’ll do our best to get there next year as well.

We have also invited attendees to take part in a license raffle at the booth, and we are now happy to announce the 10 lucky winners. Here they are:

  • Magnus Kivi: IntelliJ IDEA Ultimate license
  • Robert Broden: IntelliJ IDEA Ultimate license
  • Alexander Tarnowski: IntelliJ IDEA Ultimate license
  • Henrik Andersson: dotTrace Performance + Memory licenses
  • Olle Jacobsen: dotTrace Performance + Memory licenses
  • Erik Agren: dotTrace Performance + Memory licenses
  • Shmuel Gershon: dotTrace Performance + Memory licenses
  • Jens Ribbholm: ReSharper license
  • Tommy Savela: ReSharper license
  • Jukka Puranen: RubyMine license

Congratulations to those lucky devs who should receive their license certificates in a short while. Develop (and profile) with pleasure!

ReSharper 6.1 EAP for Visual Studio 11

November 10th, 2011 by Hadi Hariri

We recently announced the availability of ReSharper 6.1 EAP which includes initial experimental support for VS11. What wasn’t included was an installer, which made the whole support pretty much useless. We only realized this after shipping it and someone tweeting “WTF is VS11 checkbox?”

FAIL!

In all seriousness though, we knew that this was missing. We had intended to provide a VSIX that allows you to install ReSharper 6.1 in VS11 on the same day of the release of EAP, but it didn’t happen. However, that VSIX is now available, and you can obtain it from the nightly build (which btw have resumed) page, as well as the SDK. The evaluation license key for the VSIX is also provided. To install it into VS11, merely close down the IDE, double-click on the VSIX and you’re done.

If you have any issues please report them here or on our forums.

MSpec Runnner Available for ReSharper 6.1 EAP

November 10th, 2011 by Hadi Hariri

Below is a link to the MSpec binaries compatible with ReSharper 6.1 EAP. This is just a temporary link until MSpec is officially updated by Alex who’s currently chasing Elephants in Uganda!

Download the binaries from here

Please give us feedback here if you have issues.

Thanks.

ReSharper 6.1 EAP Opens: Much More than a Bugfix Release

November 4th, 2011 by Jura Gorohovsky

It took longer than expected but here we are, opening the ReSharper 6.1 Early Access Program that’s meant to eliminate any pain points you might be having with ReSharper 6.0, via performance and bug fixes. However, ReSharper 6.1 also provides a lot of new functionality that all 6.0 users will be getting as a free upgrade.

UPDATE! ReSharper 6.1 is officially released, Early Access Program is over.

Here are some of the best reasons why you should totally try ReSharper 6.1:

  • Performance fixes: Has ReSharper 6.0 been harsh on you performance-wise? Has it been processing source files longer than expected? 6.1 shouldn’t. Here’s the list of performance issues that have been fixed.
  • Bug fixes. The list of bugs fixed for 6.1 is here for you, highlighted by massive efforts to improve unit testing, structural search and replace, VB.NET code resolve, as well as code completion and typing assistance in ASP.NET MVC 3 (Razor).
  • New settings engine. Settings have been revamped extensively, with extra emphasis on sharing and managing them. We have made many more settings accessible and sharable, and introduced new granular settings — for example, those for IntelliSense behavior for different languages. Settings are now layered meaning that you can define global, per-solution, per-team or individual settings. You can now export and import all or selected settings to/from a single file — for this and other settings management operations, use the new Manage button under ReSharper > Options.

  • Here’s a rough list of settings-related problems solved for 6.1. Mind you, nothing is set in stone yet. We’re still making changes to this subsystem, and we’ll do that based on feedback from you and your team.

  • Support for Async CTP. You have asked for it: Not only does ReSharper 6.1 support async and await keywords — both in C# and VB.NET — but it also provides a set of code inspections and quick-fixes: for example, it sees dead code when an asynchronous method lacks await operators, and warns when you’re using a wrong return type in an asynchronous method.
  • Optimize Assembly References. This has been requested for even longer, and here it is: ReSharper 6.1 detects any references that are not effectively used in your project, and provides a nicely built UI to get rid of all or some of them. Project maintenance just got easier with ReSharper!
  • Experimental support for the initial Visual Studio 11 Developer Preview. We have adapted ReSharper to run under Dev11, and it does so fairly well with existing code. Manual setup is required here, and we’ll follow up with a post containing VS11 install guidelines. However, please understand that this is only initial, experimental support for existing types of projects with a specific Developer Preview build (the one made available on September 16, 2011.) We can’t guarantee any consistency of your experience with ReSharper 6.1 EAP (or even the future release of 6.1) under VS11 Developer Preview. Needless to say, no support for developing Metro style applications is there. Official support for VS11 will not be made available any earlier than the next major ReSharper release.
  • ReSharper SDK. This is something that should simplify ReSharper plug-in development dramatically. Delivered as an MSI or ZIP file, the SDK provides a full set of ReSharper assemblies, including test infrastructure assemblies required to test ReSharper plug-ins, target files, and (in the MSI version) Visual Studio templates for creating different kinds of plug-in projects.
  • A great load of improvements relevant to web developers. This includes new quick-fixes and refactorings for CSS; Structural Search and Replace for HTML and ASP.NET; Move Helper refactoring, internationalization and Call Tracking for ASP.NET MVC 3; generation of event subscriptions in ASP.NET; a UI to configure path mappings for web site deployment; and many more improvements, some major, others not so much, that we’ll be expanding upon in a separate blog post.
  • New code inspections and quick-fixes for C# and VB.NET. Aside from the set of Async CTP related inspections, ReSharper 6.1 has also improved in terms of control flow redundancy analysis (for instance, detecting more cases of redundant return statements); it also detects access to disposed closure and covariant array conversions, and provides corresponding quick-fixes where available.
  • XAML support improvements including code completion enhanced in certain scenarios, batch generation of event subscriptions, improved attached property awareness in error highlighting and code completion, as well as an option to create a namespace alias from usage:

We have also added a new refactoring to convert iterators to methods; internationalization for VB.NET projects; navigation and search updates including Quick Search in Type Hierarchy window, export to HTML and XML from all tool windows supporting import/export functionality; and more. There are simply too much changes, subtle and prominent, to summarize in a single blog post without turning it into an encyclopedia.

For die-hard fans, here’s the list of all YouTrack issues fixed for 6.1.

Go forward and download ReSharper 6.1 EAP builds ReSharper 6.1 official release, and expect more blog posts covering 6.1 functionality in greater detail to come up soon.