14 January 2008

One Line - Find Usages Advanced

When you want to search for all overloads of a method, or search for type and its members usages, or search in referenced libaries in addition to source code - use Find Usages Advanced command (ReSharper | Search | Find Usages Advanced...).

20 December 2007

ReSharper 3.1 is Released!

We are proud to announce the release of ReSharper 3.1. The new version not only brings many bugfixes, improved stability and new features, but also provides the opportunity of free upgrade to v4.0 for new purchases.

This minor - but extremely upgrade-worthy - release extends support for various technologies and languages including ASP.NET, VB.NET and XAML, and introduces the amazingly powerful Solution-Wide Analysis. The new feature lets you instantly find compilation errors in your whole solution - not just in the currently opened file.

Download it now and review release notes.

18 December 2007

One Line - Filtering Popup Lists

When recent files list is open, you can start typing and list will get filtered to show only items which contains entered text. This feature also works in all "Go to" popup lists, like Go To Usage or Go To Inheritors.

17 December 2007

One Line - Moving Code Around

Holding Ctrl-Alt-Shift and pressing arrow keys moves code around. It can move members up and down, reorder parameters in place, move statement within a block, move statement out of block or into block, and move XML tags around. Note, that it is just textual editing, it doesn't check if such move would be valid or fix any references.

16 December 2007

One Line - Naming Style

If you configure your field naming preferences in options (Options / Languages / Common / Naming Style), ReSharper will derive better names for properties and other entities when generating code.

12 December 2007

One Line - Create File From Template

You can use Alt-Ins in Solution Explorer to create file from one of your File Templates in the current folder.

Feature of ReSharper 3

11 December 2007

ReSharper and Visual Studio crash on x64

For those who experience problems running ReSharper on x64 machines, here is the bug description on Microsoft Connect.


It turns out that this crash is the result of a bug in the Wow64 layer of Windows x64 (XP/2003 – it has been fixed in Vista x64) and only manifests itself when another app globally hooks all Windows messages.
We are currently working with the Windows servicing folks to get a hotfix produced.


Updated 13 Feb:
Deep in the comments to the aforementioned request there is information about how to obtain hotfix:

If you are experiencing this issue you will need to contact Microsoft Customer
Service & Support (http://support.microsoft.com) and ask for the Windows
Hotfix with ID 947841. If you have any difficulty in obtaining the patch
ask the CSS representative to contact me (Sean Laberee).

I am also pleased to announce that we have created a workaround in VS 2008 SP1 which eliminates this problem and the need for the patch. That workaround is queued for checkin to our build process and will be available in the Beta of the service pack.

And also:

A quick update on the windows patch. I've confirmed with our support team that if you call in for this hotfix you will not be charged. They will set up a "Hot Fix" case for you. I've also received a report that there was some confusion as to whether this fix is for Win2003 or XP. I've confirmed that this fix does in fact apply to both releases.

28 November 2007

ReSharper Club - Are You In?

Well, not really a club, but we thought you may wish to have cute ReSharper banner on the side bar of your blog, or project site, or may be print it and put on the wind-screen of your Porsche :) I have one right here, in my blog! Ah, well, I mean banner, not Porsche...

Want it? Go to The Banner Builder page and assemble it as you like. Don't forget to put the result on your website!

22 November 2007

ReSharper and Visual Studio 2008

Since there is a lot of buzz about Visual Studio 2008 release, I thought I would stand and say about ReSharper in relation to this fact.

Released version

ReSharper 3 can be installed with Visual Studio 2008 and works fine, unless you are using C# 3.0 new features, like lambdas, LINQ, extension methods and such. This constructs are not parsed by ReSharper 3, which was developed to support C# 2.0 only. It is not only highlighting which doesn't support C# 3.0, it is all the core and code intelligence. For example, rename refactoring will not find usages of extension methods and will not update them.
There also could be some glitches, even if you don't use new C# 3.0 constructs. This is due to the fact that C# 3.0 compiler is always used in Visual Studio 2008 C# projects, regardless of target framework. It it is not widely discussed, but changes in language are wider than just several new features. There are differences in type inference in generics and candidates lookup for binding, to name few. If you happen to hit this special cases, ReSharper could behave incorrectly.

If you are really-really going to immediately jump C# 3.0 wagon, you can disable highlighting (Options / Code Inspection / Settings) and switch to Visual Studio native intellisense (Options / Environment / IntelliSense / General). This will help a bit, but still you cannot trust find usages results, refactorings and many other features.

There was also reported weird problem with Visual Studio 2008 and ReSharper installed on x64 computers - opening Visual Studio's Find dialog crashes. We are currently trying to reproduce this problem. If you experience this problem, please tell us!

Some people tend to ask for quick-and-dirty hack for ReSharper 3 so that it just parses the code and don't do anything intelligent with C# 3.0 code. It is not possible. Details are not important here and are pure technical.

Next version
ReSharper 4 is in very active development. Its main purpose is to support C# 3.0 in all of its beauty. This means not only parsing and code intelligence, but also new analysis, refactorings, context actions and quick fixes. We are concentrated on making your development experience with C# 3.0 as smooth and pleasant as possible.

Currently, we have support for implicity typed variables and arrays, extension methods, object and collection initializers and automatic properties. As soon as we complete support for lambdas, queries and anonymous types, we will open Early Access Program. We plan to achieve this goal in January, 2008.
From this point you will be able to download EAP or even nightly builds and try full power of ReSharper 4 with your new C# 3.0 code.

In regards of upgrade policy, we are currently in the process of deciding upgrade cost, who qualifies for free upgrade, or if we want to do something special about this release. I will post about it as soon as I can.

As for release plans, we are aiming at 2008'Q1, hopefully sometime soon after Visual Studio 2008 launch event in February. ReSharper 4 will be available to general public via Early Access Program at least for 2 months before release.

If you have any questions, do not hesitate to ask in comments.

16 October 2007

C# 3.0 Automatic Properties - Incomplete Feature?

Well, C# 3.0 is nice language. However, digging into details of every new language feature while developing ReSharper support make me wonder about little things that look like incompleteness. Today I'm going to wonder about automatic properties.

public string Name { get; set; }

This code is correct in C# 3.0, there are no missing "abstract" or get/set bodies. It simply means that compiler will create field and accessors code for you:

private string __someGeneratedFieldName;
 
public string Name
{
  get { return __someGeneratedFieldName; }
  set { __someGeneratedFieldName = value; }
}


What is cool about automatic properties? Obviously, ReSharper users don't benefit much from shorter code - who types properties by hand these days? However there is one very important thing:

Less complexity to manage.

If you want to know how this property gets its value, you no longer need to search for both field and property usages. You don't need to synchronize field and property types, once you decide to change it. Also, access to the class attribute (in OOP sense) is fully controlled right at the place of the declaration. You can limit it as you wish:

public string Name { get; private set; }

This way you declare that "Name" can be modified only within the class itself, but can be read from outside.

So, what is missing from this language feature?

Initializer.
I may wish to initilize property to some non-default value. Like this:

public List<Person> Persons { get; private set; } = new List<Person>();

Read-only automatic property
In the example above, I don't actually need setter.

public List<Person> Persons { get; } = new List<Person>();

Obviously, you don't need read-only automatic property without initializer. Also note, that such property can never change its value, even in constructor, unlike readonly fields.

Attributes on generated fields
If you use simple event form and compiler generates field for storing delegate, you can apply attribute to the generated field by using attribute target:

[field: NonSerialized]
public event EventHandler Closed;

I wish I could do the same with automatic properties:

[field: NonSerialized]
public List<Person> Persons { get; } = new List<Person>();


Conclusion
Few simple improvements over existing implementation could make automatic properties much more useful in everyday professional .NET development. Unfortunately, language designers decided:
they would work in the "common case" which among other things means no attributes on the generated field. The idea behind that is keeping them simple and not slowly mutating them into full properties.

I'd prefer the advanced version, if I had a chance to choose.