Sunday, August 30, 2009

Installing Elmah 1.1 with nopCommerce

August 30, 2009 Posted by Jason Irwin , , , , , , 2 comments

In my spare time I’ve been working on an ASP.NET 3.5 web forms ecommerce application. In order to protect the privacy of said web site’s owner I won’t go into too many details about the application itself, except to say that it is built on top of the awesome and open source nopCommerce ecommerce solution. If you’ve never used it you should definitely check it out – it has many excellent features including language and currency localization, shipping providers, payment gateway support, tax support etc. etc. etc. The only real caveat is that the application contains a copyright notice “Powered by nopCommerce” that can be removed for a one time fee of $50.00 USD. This is a pretty cost effective solution regardless of whether or not you remove the notice…

The site is almost ready to go out the door – but before putting it online I wanted to add more robust error handling than nopCommerce provides out of the box. nopCommerce does provide some basic error logging in the administrative area of the site – but this is far too complex for the people who will eventually manage the site and I personally (hopefully) will not interact with this area of the site once it goes to production.

To my delight version 1.1 of ELMAH was released a couple of weeks ago – making my life a lot easier and adding to my increasing faith in open source .NET applications. ELMAH (Error Logging Modules and Handlers) is an application-wide error logging facility with some really neat features including:

  • Logging of nearly all unhandled exceptions
  • Remote viewing of logged errors using an independent (in my case from the actual ecommerce site) web page
  • Immediate Email notifications upon error occurrence
  • An RSS feed containing the last 15 error messages
  • Logging to multiple back-end data stores (SQL/Oracle/XML/RAM…)
  • Tweeting (yes, tweeting) of error notifications

Installing Elmah on top of nopCommerce wasn’t as simple as I thought it would be so I figured I’d post some installation instructions. If you’re interested to know what the individual configuration sections do I recommend you download the binaries and open the /samples/web.config file. This goes into much more detail than I can. As a side note, I am logging only to SQL Server, but switching to Oracle or flat XML files should be very simple. Again, read the sample web.config file.

Installation Process

Step 1: Download the latest binaries

Step 2: Copy Elmah.dll to the Dependencies folder under your nopCommerce solution.

Step 3: In VS right-click the Dependencies folder and choose Add->Existing Item. Double click the Elmah.dll file you just copied to the Dependencies to include it in your solution.

Step 4: Add a reference to this file to your web project (If memory serves this is called NopCommerceStore by default)

Step 5: Add the following to the <configSections> section of web.config

  1: <sectionGroup name="elmah">     
  2:     <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />     
  3:     <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />     
  4:     <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />     
  5:     <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />    
  6:   </sectionGroup>     


Step 6: Add the following line to the <httpHandlers> section of web.config



  1:  <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" /> 


Step 7: Add the following line to the <httpModules> section of web.config



  1:  <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />  




Step 8: Add the following line to the <system.webServer><modules> section of web.config



  1: <add name="Elmah.ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />


Step 9: Add the following line to the <system.webServer><handlers> section of web.config



  1:  <add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />




Step 10: Add the following sections right under <configuration>



  1: <elmah>
  2: <security allowRemoteAccess="0" />
  3: <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="Elmah.Sql" />
  4: </elmah>
  5: 
  6: <location path="elmah.axd">
  7: <system.web>
  8: <authorization>
  9: <deny users="?"/>
 10: </authorization>
 11: </system.web>
 12: </location>




Setting up SQL Server Logging


Step 11: Create a new database. For example, call it ElmahDB. (optionally, use your existing nopCommerce database for logging errors. I personally prefer to separate the two…)



Step 12: Connect to the database you created in Step 8 using SSMS and run this SQL script. This will create the DDL object necessary to log errors with Elmah.



Step 13: Add the following line to the <connectionStrings> section of your ConnectionStrings.config file:



  1:  <add name="Elmah.Sql" connectionString="Data Source=myserver;Initial Catalog=ElmahDB;Integrated Security=False;Persist Security Info=False;User ID=myuser;Password=mypassword;Connect Timeout=120"/>


Step 14: Add the following to the <configuration> section to your web.config file:



  1: <elmah>  
  2:   <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="Elmah.Sql" />  
  3: </elmah>  


The Catch


At this point you can run your debugger and open your site. My site is called NopCommerceStore so by default the debugger opens a page at http://localhost/NopCommerceStore/Default.aspx



To open the Elmah logging page replace Default.aspx with elmah.adx so that your URL becomes:



http://localhost/NopCommerceStore/elmah.axd



The first sign that something is awry is when the page opens and it is ugly as sin – with no styling applied as in the following screenshot:



image



The second is that clicking on any links or attempting to generate a test exception (by going to http://localhost/NopCommerceStore/elmah.axd/test) results in a 404 (page not found) error. This drove me mad for a while UNTIL I realized that I could use another instance of Elmah (pointing to the same database) to try to track down the problem. It took me about 60 seconds to create a new web project and do the above configuration. Running the project, I saw a far cleaner and fully functional interface.



image



Immediately I was able to see existing error messages, and quickly realized what the issue was. Take a look at the text highlighted above – do you notice anything? That’s correct – each of the paths that does not exist points to a file called default.aspx. 




System.Web.HttpException: The file '/elmah.axd/stylesheet/default.aspx' does not exist



System.Web.HttpException: The file '/elmah.axd/detail/default.aspx' does not exist



System.Web.HttpException: The file '/elmah.axd/rss/default.aspx' does not exist



 




Nothing unusual, right? Not until you realize that nopCommerce uses URL rewriting pretty extensively for SEO optimized URLs etc.



The Fix


Fixing the above issue was pretty straightforward – open the UrlRewriting.config file in your solution. Remove the following line:



  1:  defaultPage="default.aspx"


This essentially stops nopCommerce from appending the default.aspx extension to urls for files without extensions – in our case for Elmah. Now, here is my “Works on my PC” warning. Removing this entry did not break anything in nopCommerce…for me. However I am using a customized version based on 1.10. There have been some new releases since then. What I DEFINITELY recommend is to set Default.aspx as a default document on your website. This should handle cases where a specific file is not requested and avoid the need for the defaultPage setting above.



In the end it was a little more work than I had expected but, knowing what I know now, it would be easy to have the necessary configuration in place in about 5 minutes. Such a robust error handling/logging facility is a GREAT return on investment in either case!

Friday, August 28, 2009

WPF - Custom Control VS User Control

August 28, 2009 Posted by Jason Irwin , , , , 1 comment

In WPF what is the difference between a Custom Control and a User Control? This is pretty basic stuff but I hear this question being asked a LOT so figured I’d do a quick post on the subject.

A user control is essentially the composition of various controls into one larger control allowing a whole group of controls to be reused. It is extremely similar to creating a Window/Page in WPF – you have access both to the XAML markup and the code-behind and can employ the same techniques (drag/drop, declaratively through XAML) when adding child controls.

If you have an ASP.NET background this will seem extremely similar to an ASCX control – which it is. Both are used to partition common user interface components and allow them to be reused as a single unit in the future. As an example, take the following address input mockup. The user may be asked to enter their address when registering an account with the application/choosing a delivery address for a product/choosing a billing address for a product/etc. The control itself is exceedingly straightforward – it contains 6 labels, 4 textboxes and 2 combo boxes. The question is, do you want to duplicate the markup and behavior behind these fields every time you need a user to input their address? Probably not…this is where a user control comes in handy!

 image

A custom control, on the other hand, acts as an extension point for existing control. You do not have access to the markup but instead add extra functionality to the control using themes and user defined templates. The magic of custom controls is that you are able to inherit from a wide range of existing controls. Therefore, if a control fulfills 90% of your needs, you can base a custom control on this existing control and build your additional behavior on top of it.

For instance, imagine (if you can) a textbox that displays your total word count. Obviously 99% of the work is the creation of the textbox – the rest is easy. A custom control would allow us to define a new CountingCheckBox (I came up with the name all by myself) control deriving all of the features of a regular textbox.imageCustom controls, unlike user controls have the added benefit of being theme-able, making them the more appropriate choice when creating suites of controls.

And that is that!

.NET Runtime version 2.0.50727.3082 - Fatal Execution Engine Error (7A2E1132) **Updated**

August 28, 2009 Posted by Jason Irwin , , , , 3 comments

I’m working on a WPF project right now and Visual Studio has been crashing more often than I would like. The event viewer shows a .NET Runtime Error with the following message:

.NET Runtime version 2.0.50727.3082 - Fatal Execution Engine Error (7A2E1132)

I am running Visual Studio 2008 SP1 and it has been pretty solid for the last couple of months – up until last week. The only new piece of software I’ve installed is Gallio (3.0.6.787) and the timeframes for the installation and the occurrence of this issue are suspiciously close. I searched the mb-unit issue log on google code (http://code.google.com/p/mb-unit/issues/list) and found a similar closed issue (albeit it was logged under ResharperRunner which I am not using).

The issue was closed as not reproducible but the body of the bug report was very similar to my own experience:

What steps will reproduce the problem?

1. Open a WPF Window (XAML file) in Designer and/or XAML mode

2. VS crashes without a message. In Application eventlog you find the

error: .NET Runtime version 2.0.50727.3053 - Fatal Execution Engine Error

(7A2E0F92) (0)

3. If you uninstall Gallio, there is no problem anymore.

Fortunately, my issue was easily reproducible – when switching from code to design views for a specific WPF page, my system would consistently crash – things are rarely this straightforward! The solution in my case was to uninstall Gallio. I’m currently working with MSUnit (post to follow) and do not need to have this software installed – even though I reaaaallly like it…It is critical that Visual Studio runs without crashing every time I open up the design view so Gallio must be sacrificed for now.

Update

For those who haven't yet read the comments on this one, Jeff Brown (of Gallio fame) has provided some feedback. It appears to be a MSFT related issue and not limited to Gallio. I won't have a chance to play with this until next week, but if Jeff is right (and he most likely is) I'll get to play with Gallio some more. I will of course add another update once I know more. Here's Jeff's comment:

IIRC, someone else reported the same issue involving interactions with the XAML editor. Apparently this also happens with other add-ins besides Gallio.

It was resolved by:
http://support.microsoft.com/kb/963676

More info:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=362944&wa=wsignin1.0


Friday, August 21, 2009

Gallio – Visual Studio Integration – Issue with output of data-driven tests

August 21, 2009 Posted by Jason Irwin , , , , , , 3 comments

I recently came across the Gallio platform, a “common object model, runtime services and tools (such as test runners) that may be leveraged by any number of test frameworks”. Essentially Gallio acts as a one stop shop for test integration and the “killer feature” for me is it’s integration into the Visual Studio test view. For those of us that do not have access to Resharper or Testdriven.NET (and have no way of running anything but MSTest tests directly through Visual Studio), Gallio’s offering is very appealing. It allows the user to run any test type supported by the Gallio platform (MbUnit, NUnit, xUnit, etc.) through Visual Studio as if they were MSTest unit tests – brilliant.

For instance, the following screenshot shows a few simple MbUnit tests in Visual Studio, as well as the test run results in the Test Results window…

image

An unfortunate limitation of the mismatch between MSTest’s restricted feature set and MbUnit’s far more expressive set is that some more advanced features are lost in translation.

  1: <Test()> _
  2: <MultipleAsserts()> _
  3: <Row(3, 3)> _
  4: <Row(3, 17)> _
  5: <Row(1, 2)> _
  6: Public Sub MyRowTest(ByVal val1 As Int32, ByVal val2 As Int32)
  7: 
  8:     Assert.AreEqual(Of Int32)(val1, val2)
  9: 
 10: End Sub


For instance, the above rowtest should run three times and fail twice. However it completes successfully with the following message:




MyRowTest(3,3) Duration: 0.016s,



Assertions: 2




Luckily for me, I posted the issue (ineloquently) on Stackoverflow, and Jeff Brown (MbUnit and Gallio lead) not only answered but logged the issue as an enhancement for an upcoming milestone. Perfecting this integration would make Gallio a must for us developers with a limited tooling budget who want to integrate non MSUnit tests into our .NET projects and do not fancy ALT-tabbing all over the place.

The value '' of the MaximumValue property of 'RangeValidator1' cannot be converted to type 'Date'.

August 21, 2009 Posted by Jason Irwin , , No comments

I ran into a stupid problem tonight when working on an ASP.NET site and I thought i’d share the very obvious answer I ran into…

Essentially, I was adding a textbox with an asp.net ajax control toolkit calendar extender to my form. I needed to ensure that a date, prior to today’s date, could not be selected – a pattern pretty common in web apps. To do so I added a range validator to the form and added a minimum value of today’s date to the page load event in the codebehind.

<asp:TextBox runat="server" ID="txtDate" />
<asp:ImageButton runat="Server" ID="iEndDate" 
ImageUrl="~/images/Calendar_scheduleHS.png"
AlternateText="Click to show calendar" />
               
<ajaxToolkit:CalendarExtender ID="cEndDateButtonExtender"
runat="server"
TargetControlID="txtDate"
PopupButtonID="iEndDate" />
<asp:RangeValidator ID="RangeValidator1" runat="server" 
ControlToValidate="txtDate" 
ErrorMessage="You cannot choose a date prior to today" 
Type="Date" />


 



protected void Page_Load(object sender, EventArgs e)
{
RangeValidator1.MinimumValue = System.DateTime.Now.ToShortDateString();
    
}


Upon loading the web page, I received the following error:




The value '' of the MaximumValue property of 'RangeValidator1' cannot be converted to type 'Date'.




The solution is obvious – but eluded me for about 5 minutes…the RangeValidator does as it’s name suggests – it validates a range. I provided only a MinimumValue and no maximum value and the code was attempting to validate between two bounds. This was a conscious design decision on Microsoft’s part, and one which I fully understand. A bug report was logged and swiftly closed on the MSFT Connect site with a representative suggesting the following fix:




As an alternative you can derive from RangeValidator and override the property ControlPropertiesValid. In the custom implementation just call base.ControlPropertiesValid(). This will have the effect of skipping the additional internal validation step that currently triggers an exception. You will also need to override EvaluateIsValid for the case where either MinimumValue or MaximumValue are outside of the expected range - otherwise the internal evaluation logic will always fail when it attempts to convert String.Empty or a very large value to an integer.

Thursday, August 20, 2009

Google Chrome – Bookmark Sync…to Google Documents?!?!

August 20, 2009 Posted by Jason Irwin , , No comments

By now most of you probably know that the latest dev channel build of Google Chrome (link) enables bookmark syncing – for me an absolute must-have feature that I’ve been dying to get my hands on…all you have to do is download from the dev channel or use the channel changer and then start chrome up with the --enable-sync command-line flag. It works pretty well (shortly after installing it on my home box i reimaged my pc and lo-and-behold, there were my bookmarks waiting for me when I installed Chrome).

However, one thing really does not sit right with me: bookmarks are synced with Google Documents and not Google Bookmarks…does this seem counter-intuitive to anyone else?…kind of like saving my bookmarks as flat files in the My Documents folder in Windows…The reason, I believe, is pretty straightforward, though you may correct me if I am mistaken. Google Documents uses XMPP (Extensible Messaging and Presence Protocol) to essentially push messages in real time rather than having a client poll a server at a set interval – something which, I guess, Google Reader does or can not do. While the functionality works, and works well, it seems like a bit of a hack and to all of us building up a library of bookmarks in Google Bookmarks a less than ideal solution. I guess i’ll give Google the benefit of the doubt (this is a beta feature after all) and continue hoping that they come up with an official way to reconcile these disparate systems.

Monday, August 10, 2009

Throw vs Throw ex

August 10, 2009 Posted by Jason Irwin , , 1 comment

This tidbit should be commonly known but in my experience is often overlooked and therefore worth a blog post. In short, there is a big difference between using Throw and Throw ex to re-throw an exception in .NET. Essentially, when using the Throw ex syntax parameters including the stack trace itself are reset resulting in unreliable stack traces when exceptions are bubbled up through an application.

To provide a brief example take a look at the following code. I have created a console application with three classes:

image

We have Program – the entry point to the console application. The main procedure creates an instance of a DogWalkerClass and runs the WalkDogWithThrowEx or WalkDogWithThrow procedure depending on the value of the throwWithEx field. Both of these procedures in turn create an instance of the BadDog class and calls the WalkDog procedure. The WalkDog procedure has one-and-only-one purpose – to throw an exception.

Program.cs

  1: using System;
  2: using System.Collections.Generic;
  3: using System.Linq;
  4: using System.Text;
  5: 
  6: namespace ThrowDemo
  7: {
  8:     class Program
  9:     {
 10:         static void Main(string[] args)
 11:         {
 12:             bool throwWithEx = true;
 13:             DogWalkerClass dw = new DogWalkerClass();
 14: 
 15:             try
 16:             {
 17:                 if (throwWithEx)
 18:                 {
 19:                     dw.WalkDogWithThrowEx();
 20:                 }
 21:                 else
 22:                 {
 23:                     dw.WalkDogWithThrow();
 24:                 }
 25:             }
 26:             catch (Exception ex)
 27:             {
 28:                 Console.WriteLine(ex.StackTrace);
 29:                 Console.ReadLine();
 30:             }
 31:         }
 32:     }
 33: }


 



DogWalkerClass.cs



  1: using System;
  2: using System.Collections.Generic;
  3: using System.Linq;
  4: using System.Text;
  5: 
  6: namespace ThrowDemo
  7: {
  8:     class DogWalkerClass
  9:     {
 10:         public void WalkDogWithThrow()
 11:         {
 12:             try
 13:             {
 14:                 BadDog gd = new BadDog();
 15:                 gd.WalkDog();
 16:             }
 17:             catch (Exception ex)
 18:             {
 19:                 // TODO: Perform some additional logging here
 20:                 throw;
 21:             }
 22:         }
 23: 
 24:         public void WalkDogWithThrowEx()
 25:         {
 26:             try
 27:             {
 28:                 BadDog gd = new BadDog();
 29:                 gd.WalkDog();
 30: 
 31:             }
 32:             catch (Exception ex)
 33:             {
 34:                 // TODO: Perform some additional logging here
 35:                 throw ex;
 36:             }
 37:         }
 38:     }
 39: }
 40: 


BadDog.cs



  1: using System;
  2: using System.Collections.Generic;
  3: using System.Linq;
  4: using System.Text;
  5: 
  6: namespace ThrowDemo
  7: {
  8:     class BadDog
  9:     {
 10:         public void WalkDog()
 11:         {
 12:             throw new Exception("An error occurred in the baddog class");
 13:         }
 14:     }
 15: }
 16: 


If the throwWithEx field is set to true, the WalkDogWithThrowEx procedure is called. Inevitably the WalkDog procedure is called, an exception is thrown and is bubbled back up to the Program class. Because we are using the Throw ex syntax the stacktrace is reset locally upon re-throwing the exception and we are left with a shallow stacktrace that indicates the error originated in the DogWalkerClass class at line 35. We know this to be false – since we threw the exception ourselves in the BadDog class.



image



If, on the other hand, the throwWithEx field is set to false, the WalkDogWithThrow procedure is called. Again, the WalkDog procedure is called, an exception is thrown and is bubbled back up to the Program class. This time we are using the Throw ex syntax. The stacktrace is persisted (i.e. not reset) and we are left with the original, deeper, stacktrace that indicates the error originated in the BadDog class at line 12.



image



This is certainly not rocket science – but you’d be surprised how often this is misunderstood or not known at all. Try to envision the additional complexity involved if we had 1,000,000 LOC rather than a paltry 100 LOC. It’s the small things that get you in the end…

Sunday, August 9, 2009

Windows 7 (Build 7100) – Program Icons Disappeared

August 09, 2009 Posted by Jason Irwin 4 comments

I recently ran into an odd bug with Windows 7. I am running build 7100 and don’t yet know if this pertains to the recent RTM release.

After running the Beta (which was extremely stable) for a few months, I woke up one morning to find that my Program icons had disappeared. Clicking on Start->All Programs resulted in the following:

image

As you’ll notice from all the icons in the background – I haven’t been keeping my desktop (or PC in general) too tidy. Knowing that I was running in a beta led to the thinking that i’ll reimage it soon, so can trash it now. As it happens, this general untidiness led to the disappearing icons.

The following link suggested that Windows 7 (at least the 7100 build) could only handle approximately 70 shortcuts in the Program menu. Apparently I had recently installed a few more applications that sent me over the top.

The solution was to delete a few items from my programs directory. This was achieved by:

1. Clicking Start

2. Right Clicking on All Programs

3. Left-clicking Open to view the shortcuts installed only for my username (and clearing the clutter) and Left-clicking Open All Users to do the same for shortcuts installed for all users on the box.

Simple, right?

Wednesday, August 5, 2009

Syncfusion – Essential Studio ASP.NET MVC Edition - $5

August 05, 2009 Posted by Jason Irwin , , No comments

On Monday August 10th Syncfusion will offer their Essential Studio ASP.NET MVC edition for $5. The limit is 5 licenses per company and the s/w is licensed per developer with 30 days of subscription coverage. Given that the software is normally $995 this is a steal. Click here for more info. Proceeds go to One Laptop Per Child.

Tuesday, August 4, 2009

Coderush vs Resharper

August 04, 2009 Posted by Jason Irwin , , , 20 comments
  

I’m shocked to admit that my programming side projects are consuming so much of my free time that I am considering the purchase of a tool to help me develop faster and better. The company I work for has an extremely limited budget and there is no way they will be sponsoring such a tool in or outside of work (I know, I know – the ROI should easily justify the cost…) so this one will be coming directly out of my own pocket. I’ve done the reading, downloaded the demos and fallen in love with both Resharper and Coderush (NOTE: If I refer to Coderush in this post I am actually referring to the combination of Coderush and its partner in crime Refactor). There are a lot of opinions in the blogosphere as to which tools is better. My goal of this post is to define a set of metrics that measure application features and concerns that are important to me, a measure of weight for each value and a final calculation to determine which tool I will in fact purchase.

There are some acknowledgements that I would like to make up front:

1. I am in no way linked with either organization or any organization in this space. I have no bias.

2. I have been working with the demos of these tools for the last 2-3 weeks. This short duration coupled with splitting my attention between the two tools means that I am an expert on neither. I am sure that some of the comments I make can be corrected by those who know more on the subject than I do and I would be grateful of anyone who can provide constructive criticism. I will edit my post (and let you know when I do) and scores based on any feedback I receive.

3. Most of the projects I am working on are in the genesis or near-deployment phases. While the latter is a good time to get into refactoring, I am not currently working on the meat of a project where code templates and other such niceties are at their most useful. To test these features I am contriving some somewhat artificial test apps. The only thing I believe that I am really missing out on here is an accurate sense of how much time I would be saving in a production scenario. However, it should still be feasible to compare the abilities of both tools.

4. The ratings I make are based on the factors that are important to me. I say this not to mute criticism (again, the constructive variety is appreciated) but to admit that there is a personal aspect to this comparison and I do not wish to bash any product or turn perspective purchasers away from either company. If different factors matter to you, then use them. if I am missing a crucial feature that ANYONE should use, then let me know.

5. I believe that either of these products will substantially improve productivity over Visual Studio on its own. If they were free applications I can guarantee I’d have both running side by side and use the best features of each as if they were a single application. However, my disposable income can only stretch so far and so I will be forced to choose between two great tools.

6. To those in similar positions who need to foot the bill themselves: estimate what your personal time is worth to you. Put a dollar value on it. This is not the same as what you would charge as a consultant – it is more to do with what you feel your spare time is worth. I came up with an EXTREMELY conservative estimate of $20 per hour. If either tools saves me 12 hours of work in a year then my ROI is in the green and I am enjoying time that I used to spend working. Give it a shot – it’ll change the way you think about purchasing this S/W yourself.

CLICK HERE TO SEE THE RESULTS TO DATE

 

    Resharper Coderush and Refactor Pro
Criteria Weight (10) Score Comment Score Comment
Cost
(Personal License)
10 3 $199 2 $249
Renewal
Cost
6 3 Approximately $119 per personal license major upgrade. I.e. upgrading from the full version 3.x to full version 4.5 would cost $119. 3 $99 per year
Coupons 3 2 Resharper has a referral program and if you know someone (search the blogosphere) with a copy you might be able to get a 10% discount. Not a fortune but $20 is worth saving. Also, the products are now $179 vs $249 which makes resharper quite a bit more cost effective. 0 No coupons or discounts as far as I can tell. There used to be one - but it looks like it expired at the end of 2007. Please feel free to prove me wrong!
Trial Length 2 4 30-60 days (60 if you know someone in the referral program - see coupons section) 4 30 days. Pretty much the standard out there. No complaints here.
Performance 9 4 Performance was surprisingly good on my laptop - and nothing performs all that well on my laptop. I expected the on-the-fly error detection to choke visual studio but to date it has been pretty good. Every now and again Visual Studio crashes but I can't necessarily blame that on Resharper. It is definitely slow when it analyzes my solution (i.e. solution-wide error checking is on) but not unusable by any means. 4 So far things have been pretty fast on my desktop but is at times sluggish on my laptop. Specifically, the code analysis hints in the scrollbar tend to take a while to pull up. Similarly to Resharper, I expected this one to kill my laptop altogether which it has not. huzzar!
Time-to-Market
(for new versions)
7 3 In the past resharper has taken some time to release new versions that support the latest and greatest Visual Studio. With 2010 around the corner this is a key metric. Hopefully they'll be quick with this one. 5 Coderush wins here. In the past they have supported newer versions of Visual Studio right off the bat and this seems to be something that they care about - and it is definitely something that I care about.
Documen-tatoin/
Training
8 3.5 There are some good docs and demos up there - just not as many as with Coderush 4.5 I've got to give it to Coderush here - there are tons of high quality videos on the devexpress site. Would have gottent a 5 but it is hard to tell sometimes if the videos are out of date or if they are relevant to newer versions of the application.
Look
and
Feel
6 3.5 Not ugly by any means but it doesn’t really have the eye candy that Coderush does. It wouldn’t stop me buying the tool, but as my father always says it's better to say "there you are" than "where are you" 5 It matters, Coderush is gorgeous and that's a scientific fact! I believe in the need for visual cues and Coderush has boat loads of them. 
Speed, 10 3 One of my gripes with Resharper is the constant need to switch between keyboard and mouse. If I want to convert a local variable to a constant I have to use the shortcut to convert it to a field and then follow the dialog that pops up. I HATE dialogs. Not only do i hate dialogs but I hate keyboard shortcuts that I need to write down to reference. Resharper does a LOT and it does it really well - but in terms of input efficiency it has a lot to learn from coderush. 4 I found with Coderush that everything (almost) I did, I did it from the keyboard. The keyboard shortcuts were intuitive and after a couple of days I had the basics down without even trying. The smart ALT-` key combination covered a ton of ground and all-in-all I felt a productivity increase very early in the game. I look forward to playing with it some more to see if I am really getting faster or if my computer is getting slower :o)
Features 10        
Unit
Test Inte-gration
6 3 Supports NUnit and MSTest right out of the box allowing tests to be run from straight from the code or solution explorer. Lovely feature! Additional frameworks are available as plugins…which is nice! I'd love to see either product attempt to rival testdriven.net and add some more advanced features to the mix. Not their domain perhaps, but certainly a big efficiency booster. 0 It is on the coderush roadmap, but what it will consist of is anyone's guess. It wouldn’t have been a dealbreaker if Resharper didn’t have it. But they do. So it is!
On-the-fly Error Detection 6 5 This is pretty massive and works quite well  0 Nada! Resharper cleans up on this one. Plain and simple.
Code Templates 8 5 Both tools offer great support for templates and I really had no complaints. Declaring my own in Resharper was a breeze but actually utilizing them with keyboard shortcuts was a joy in coderush. This one is pretty even methinks! 5 <--- What he said
Code Template Sharing 4 5 Allows templates to be shared by multiple users. 0 Not a dealbreaker but coderush does not proffer a straightforward method to share templates between users. Shocking, but as an individual user I wont lose any sleep over it!
Navigation 8 5 Both tools offer great  support for navigating to declarations, implementations, and so on and so forth. These improved my speed around the code 100% and I love this feature of both tools. More than anything, the ability in both apps to hold CTRL in order to unveil navigation links to class/method/etc. implementations is just astounding. Simple, but astounding. 5 <--- What he said
Code Assistance 9 3.5 The coding assistance ranged somewhere between horrible and life-changing, depending on the time of day. For instance, Reshaper gives suggestions to remove redundant variables, redundant method calls, etc. But to my horror I noticed in a .NET 2.0 C# application 3.0 constructs were suggested. For example, I was advised to convert a method call followed by property intializations to an object initializer. Needless to say this broke my build! This is something that renders useless the assistance the tool provides - perhaps it is a bug specific to my version or project, but I don't want pay to second guess the code assistance.  4 Code assistance in Coderush was excellent and I really have no complaints. A fantastic feature is the visual feedback provided on the scrollbar which allows you not only to view where there are issues in your code, but also fix them without necessarily needing to navigate to them. Brilliant! 
Code
Metrics
8 0 Resharper currently does not implement code metrics but "most likely will introduce suggestion system sooner or later" (reshaper.blogspot.com).  5 Don't get me wrong - I understand cyclometric complexity and appreciate the benefit of a quantitive measure for code complexity…I just don't do it by hand. To see a tool that not only does it for me, but inlines it in my code as low as the method level...well that is awesome! Also awesome are the various supported metrics as well as the ability to define one's own. Didn't know I needed it, now can't live without it!
Code Generation 9 5 I really like some of Resharper's in-built code generation mechanisms. Creating a method from usage can be a real time saver, as can generating properties/constructors/equality members, etc. Actually, this is the one time I will not complain about Resharper's (over)use of dialogs. The GUI menus provided for code generation give you complete control over the code you are generating and I LOVE this area of Resharper. 5 This is another area in which both Coderush and Resharper have invested heavily. Similar to Resharper's 'create from usage' mechanism, coderush offers intelligent class/member declaration. 
Code Formatting 9 5 supports NUnit and MSTest. Allows tests to be run from the code or solution explorer. Lovely feature! Additional frameworks are available as plugins…which is nice! 3.5 Not built into the application but available through a plugin called CR_Classcleaner. It is great to have a community building such plugins and great that this functionality is available. However, I'd love this to become part of the core so that a) I don't need to reinstall it every time the dxcore is updated and b) I have the comfort of knowing that it is a key concern of the devexpress team - it is that important of a feature to me.
Keyboard Shortcuts 8 3 Resharper offers keyboard shortcuts to do many of the same things as Coderush. However, they took a LOT of learning and often times I found myself having to interact with the mouse after I had used a shortcut - therefore defeating the purpose a little. not terrible, but not great either! 5 Coderush wins hands down here. The key combinations are logical and intuitive and within no time the more common functions had become almost mechanical.
TODO lists 1 3 It's there but it's ugly. And honestly, it really doesn’t do much that the in-built functionality can't do…It is a bit of a lacklustre implementation and, I'm guessing, a feature for the sake of a feature. 0 Not there, but I don't care all that much. If either product adds a must-have feature in this space I'll start to care pretty quickly…
Extensibility 5 4 Resharper has an open API and includes powertools for Visual Studio. There are a bunch of plugins for everything from Nhibernate to StyleCop. It is difficult to compare 1:1 with Coderush as I have not developed a plugin for either (if I had time I wouldnt need either of these tools :o) ) but I'm definitely happy that both have the option. 4 I thought Devexpress would really shine here. They build their applications on top of dxcore and provide devs with the resources necessary to create their own plugins. There are a number of plugins out three (Google is your friend) but not as many as I would have thought. But to their credit they provide the tools needed so i cant complain. 
Languages          
C#   Y   Y  
VB.NET   Y   Y  
ASP.NET   Y   Y  
XML   Y   Y  
XAML   Y   Y  
C++   N   Y  
HTML   N   Y  
Javascript   N   Y  

RESULTS Unbelievably, after my first round of comparison, there is a single point separating two applications!! These scores were not contrived and it was not by goal to be controversial. The closeness of scores proves a predicament as I am really no closer to choosing between the tools as I was when I started my testing 2 or 3 weeks ago. It looks like I will have to do some more testing before parting with my hard earned cash! Any advice would be much appreciated!

[UPDATE]

Hey folks,

Thank you for your excellent feedback regarding resharper vs. coderush. I am currently unable to reply inline to comments (blogger recently introduced support for this so i have to update my theme...) so i'm going to do one small post that will hopefully cover some of the points hit on in your comments.

1. Full disclosure: Last night I attended the monthly Chicago Alt.Net user group meeting and won a copy of resharper! I'm really pumped about it. If nothing else I will be able to dig really deep into resharper and hopefully optimize my development in the long run. That said, because I am EXTREMELY interested in these tools and what they can do (and I believe healthy competition leads to cross-pollination that benefits us all) I still plan a second post in this series. I will remain completely unbiased. Expect a follow up in the next few weeks….

Because I’m on the subject I’d like to point out that the Chicago Alt.NET meetings are awesome and full of informative information. If you’re in the area stop by – you’ll always learn something new from these (http://www.chicagoalt.net/Home)

2. To those who commented on "on the fly error detection" in Coderush - you are completely correct. The version I was using for my comparison was an older one than that which is available now. My redux post will take this into consideration.

3. I don’t know much about support for F# though read that 4.5 has improved support for F# therefore would expect some support for F#. very informative, I know…

4. I am pretty pumped to hear about access to daily build of R# but even more pumped that there is a beta plugin for VS2010.

5. I DEFINITELY should have talked more about Coderush Xpress – I just ran out of time and space. I will incorporate this more in my next post. With the number of plugins available this is certainly a handy tool for anyone in a similar position to myself whose employer can or will not purchase such software of its devs.

6. I was 100% WRONG about exporting templates in Coderush. I apologize for the misinformation. I spoke to a member of the coderush team who told me that:

“we actually do support template sharing through version control, email (you can export and import template folders and share those with colleagues), and through a shared settings folder on a network.”

7. Apparently I didn’t go into refactoring in enough depth – I hear your suggestions and will incorporate your feedback in my next post.

8. I have not yet used CTRL-SHIFT-R as a single refactoring key pattern in resharper but it appears this will address one of my concerns with having to remember a ton of keystrokes. I still love Coderush’s shortcuts thought!

9. It looks like I need to investigate a bunch of DXCore plugins before my redux. I won’t address each comment I received but suffice it to say it is an area that deserves more attention.

There is a ton of other stuff I’m probably not hitting but my lunchtime just ended and I have to get back to work :o)

Thanks again for your feedback,

Jason