Archive for April, 2009

Resharper and Generics (or not)

I am finding quite a few issues with Resharper the more I lean on it.  Despite the issue of having to use Process Explorer to close my VS session when a bug occurs, there are other features that seem to be missing.  One thats been bugging me for some time is the inability for Resharper to help resolve a type if I declare a variable and specify it as a closed-type generic, when in fact the class isnt generic at all.  My scenario goes like this:

  1. I add a few assembly dependencies  to my project.
  2. I then think I have remembered a class I am wanting to use and declare it, such as FooBar<double>.
  3. Resharper turns FooBar red, which implies the class name isnt known.
  4. Problem is FooBar does exist in one of the assemblies that was added, but its not a generic.  Resharper reports: Cannot resolve symbol: FooBar.

To solve this I have to do Ctrl-N and look up the classname either in the browser (since I added assembly dependencies and not project dependencies, which would give me code-access), and then work out its not a generic.  While it doesnt take long to realise my error, I still expect resharper to offer to declare my variable as FooBar without the generic as one of its options that it provides to fix the problem.  As a productivity tool, this little feature would be very helpful.