Thursday 10 January 2013

Using VisualStudio C# REPL to quickly find issue

While refactoring a TeamMentor UnitTest, I hit on this error:

image

The root cause was this method (can you spot the error?):

image

To quickly debug this, I opened up a C# REPL window (I used the one from VisualStudio C# REPL but you can also use the one from the main O2 Platform exe):

image

Then I:

  • copied the body of the AutomationTests_Setup into to the C# REPL environment, 
  • fixed the errors and 
  • replicated the error:

image

Once there it was easy to find and fix the error (and get a valid Uri):

image 

Note: originally (i.e. the first time I got this bug), I actually did this while in debug mode (i.e. the REPL was running under VS debug mode, which is pretty cool)

image