I love writing code. I always wonder if writers feel this way . I am sitting here working on the next minor rev (~June2005) and also the next major rev (~October2005 [ tied to whidbey release] ) with a CTP due out around the same time as the minor rev. I am not going to go into why I can’t say 1.1 or 2.0 [oh wait I just said it ].
If you don’t know the source to Enterprise Library all that well, you might find this a little hard to follow, but hopefully you will get the point.
I got a bug on the RegistryStorageProvider not firing events when the data changes externally. So what did I do, I wrote a test. Heck it worked. OK, mark as not repro, close bug onto next task in the iteration (another bug). Uh-oh…. the tester [Gokula] turns to me smiling and says “it is still not working” (you do have your testers in the same room don’t you). Crap (not really what I said..)! I know that this works, must be something wrong with the provider… write another test. This test is easy, write the data then hook up the event handler, then open the key externally and muck with it. Yeah I said it was easy, but it turns out that it took me a while to get there. Hmmm test fails. OK, write another test…. you get the idea. OK, this sucks. I know there are those of you out there that might be going, why not fire up the debugger and start stepin’. Well, I guess I figure my tests tell me more about my assumptions than stepping through code that I already wrote .
OK, I am going to cheat a little here because I am dealing with a couple of threads… good ol’ printf er.. I mean Debug.WriteLine(“Change handler created”);. OK, never see the line. Ahhhh it is not the provider / change watcher that is broken (heck that code never runs), so must be higher up the stack. After a few more tests, found it. If you call Write before Read in the ConfigurationBuilder, the Watcher is never hooked up… oh I feel a green bar coming on. Change the code, run the test, green light. Run the suite of tests… all green.. check-in, close bug, go home, hope it doesn’t come back when I turn the lights off.