ReSharper 8 EAP Build: JIT Edition

Well it’s here. With only one day left for the previous EAP to expire, we’ve managed to get a new EAP build. All is fine. Download the latest EAP now. Let’s see what’s in store in this build.

Move Instance Method Refactoring

This frequently requested refactoring allows moving instance methods from one class to another. Take the sample class below:

Before applying Move Instance Method refactoring

We can see that the Print method uses an instance field. Invoking an Move Instance Method refactoring on this method results in ReSharper prompting us for the destination class we want to move the method to. However, in addition to moving the method, it also wraps the field, in this case with a property, and passes in the current class as an argument to the method, resulting in

After applying Move Instance Method refactoring

Note that when it comes to choosing destination classes, this refactoring only offers those that are members of the original class. It’s also worth pointing out that Move Instance Method currently only supports C# but we’re working to ensure VB.NET support in subsequent builds.

Inspecting XAML Grids

We’ve added several new code inspections and quick-fixes related to the usage of grids in XAML markup. Although present in one of the previous EAP’s we’ve now polished it up for the current release and ready to talk about it some more.

With ReSharper 8, there’s no way you can declare a control that sits in a non-existent grid row or column and get away with it:

ReSharper detects a usage of an undefined row

What we have here is a parent grid with two defined rows and a nested grid referencing a grid row that doesn’t exist. In addition to helping you actually spot the problem, ReSharper 8 includes a quick-fix that will insert all the missing row definitions if that’s the way you want to sort out the issue:

Quick-fix to add missing row definitions

It adds the missing definitions without moving the caret around, and you stay exactly where you had been before the fix was applied. If you’re working with a complex layout and you stand at a grid row property that’s several screens away from row definitions, that saves you quite a bit of navigating through your code.

There’s also a new inspection that fires up whenever a control within a grid doesn’t specify a row or column number, and suggests a fix. Note that this inspection isn’t fired for the first control in a grid since developers often deliberately leave columns and rows for the first controls unspecified.

Quick-fix to add a missing grid row property value

We’re not only adding code inspections and corresponding quick-fixes but standalone context actions as well. Specifically, there are new context actions to add or remove a row or column definition before or after the current definition, as well as one to remove the current row or column definition.

ReSharper can help if you want to add or remove a column definition

XAML Refactorings

We have added a whole bunch of refactoring and enhancements for XAML, including Extract Style Refactoring, collapsing empty tags, code cleanup, styling daemons, and more. We’ll be covering these in more detail in a separate blog post.

UI Enhancements, Bug Fixes and More

Some touch-ups have been applied to the ReSharper UI where most of the older controls are now replaced with WPF ones. We’ve also fixed numerous bug reported since the previous EAP (thanks everyone for these reports and keep them coming). Additionally, two somewhat annoying bugs have also been fixed with this release, related to MSBuild. The first one is Conditional References with MSBuild and the second has to do with ResolveAssemblyReferencesDependsOn build task.

We hope you enjoy this latest release of ReSharper 8 EAP and as always, welcome bug reports and feedback. Download the latest EAP now.

Discover more