Using Mole 2010 to compare objects

One of the most interesting features in Mole 2010 is the ability to compare objects. The tool enables you to effectively “diff” the property and field values of two different objects or of the same object at various points in time. If you are comparing two different objects they do not even need to be of the same type.

This feature makes it easy to track changes to an object while your application is running. It also makes it easy to detect differences (or lack of differences) between any two objects in your application. To my knowledge, Visual Studio 2010 does not natively support this type of debugging capability.

Here’s a quick walkthrough, showing how to leverage this feature in Mole 2010.

Suppose we have an application that shows information about people, and lets the user edit that information using a data entry screen. One day while debugging a problem with that data entry screen we open up Mole 2010 and navigate to a Person object that will be edited. 

Since we are about to test the data entry screen, we capture the state of the Person object and save it to disk. 

Next we close Mole 2010, continue executing the application, edit some values on the Person object, click a Save button, hit a breakpoint and fire up Mole 2010 again. After navigating back to the Person object we just finished editing, the MoloScope contains the object’s updated values. 

At this point, it is easy to verify whether the changes we made were applied to the Person object or not. Simply load up the file we saved moments ago and compare the property and field values in it against the values in the MoloScope. 

After loading up the comparison file, we can visually diff the two objects to see what changed and what didn’t change. The properties/fields whose value changed are bold and red, with a tooltip that displays the value loaded from the file. 

In case you want to see all of the changed properties at a glance, sort on the Value column by clicking the column header. When objects are being compared in the MoloScope, sorting the Value column will bring all of the changed items to the top of the list. 

As I mentioned earlier, this feature can be used to compare any two objects, regardless of their data types. The properties and fields are compared by name. Whatever properties/fields that exist in the MoloScope will be compared against whatever values are in the data file. 

You can learn more about the MoloScope here:

You can buy a copy of Mole 2010 here:

4 Responses to Using Mole 2010 to compare objects

  1. Nice feature… is it also possible to compare 2 objects currently in memory, without saving to a file?

  2. Josh Smith says:

    Thanks Thomas. It is not currently possible to compare two objects without first saving one object’s state to disk. That’s a good feature request, though. I’ll make a note of it.


  3. LT says:

    Thank you for creating a demo version so we can “try before we buy” but you can’t test this feature since the Demo version will only run once per debug session. This feature is the whole reason I was interested in Mole and downloaded the demo version. Could have it run twice per debug session? I’d really like to test this feature before I buy.


  4. Josh Smith says:

    Hi LT,

    Thanks for trying out Mole 2010. I see what you mean. It would be more convenient to test that particular feature if the demo could be run more than once per debugging session.

    By the way, it is still possible to try that feature with the current demo. The file you save to disk can be used in the next debugging session. Simply save the state of an object to disk, close Mole, stop the debugger, start debugging again, open Mole, load the file. I realize that it’s not as convenient as having Mole run twice in a debugging session, but it will work just fine.

    I will bring your concern up to the team.


%d bloggers like this: