Sunday, January 23, 2011

To Resharper or not to Resharper

This post was moved to my real blog: To Resharper or not to Resharper

IntelliTrace:

 

So on Thursday I had a problem with one of the Unit Tests, but it was already late so I decided to go home and get a fresh start on the problem on Sunday. I started the the Unit Test and there indeed was a problem but it was with loading data from an a file GeoDatabase – I don’t have any program that can open such a file…

So I decided to debug the problem and usually it takes a while to reach the problem. My preferred method is to let the program run the first time in debug just to get an idea of where the Exception is located. This time I noticed something, on the right side of the screen a new screen that I haven’t noticed before appeared:

Intellitrace-first-look

Selecting the first Exception navigated me to where the exception poped:

IntelliTrace-exception

  1. public static void InsertFeature(this IFeatureBuffer buffer, IFeature feature)
  2. {
  3.     buffer.Shape = feature.Shape;
  4.  
  5.     for (int i = 0; i < feature.Fields.FieldCount; i++)
  6.     {
  7.         IField field = feature.Fields.get_Field(i);
  8.         if (!field.Required)
  9.             buffer.SetValue(field.Name, feature.get_Value(i));
  10.     }
  11. }

Now this in it self was huge but I still had to know from what the exception occoured, looking at all the variables shown:

intellitrace-debug-information

So I changed the options:

Intellitrace-options

And now for some odd reason some values do show (i doesn’t):

intellitrace-shown-value

Even Locals show some data:

intellitrace-locals-data-watch

The problem was the field Status was in the file but not in the DB. So I changed the code to look at only fields that are both in the buffer and the feature – run all my framework unit test –> they passes. And then run the migration tests and they also passed.

 

//TODO: study intelliTrace more…

 

Keywords: vs2010, intelliTrace, Exception, unit test