4 Advil later and my head really hurts. Here is a little story about how a simple little typo can really cause major headaches and pain.
Yesterday I was in the process of setting up one of our new WCF services to use Jimmy Bogard’s solution to use StructureMap to create our services. At one point during my development I had the setup correct because when I would do a ObjectFactory.WhatDoIHave() I could see the output. However, a few minutes later everything was broke. Not knowing what had changed (I had not yet committed anything to svn so I could not do a compare even) I did what most developers do, I tried it again and again just hoping it would magically work. (ok, what I really did was kill the dev web server, restarted IIS, restarted VS, etc). After about 30 minutes of trying to determine what had changed I finally went home for the night, hoping that a new day would magically solve the problems.
Well, when I came in today the problem was still there (looks like my laptop Gremlins took the night off.
Can you spot what is wrong with this code?
ObjectFactory.Configure(
scanner =>
{
scanner.AddRegistry( new IoCDataStrategyRegistry() );
scanner.AddRegistry( new IoCLicensingRegistry() );
}
);
Did you see the error? It is subtle. Ok, give up, take a look at this code
ObjectFactory.Initialize(
scanner =>
{
scanner.AddRegistry( new IoCDataStrategyRegistry() );
scanner.AddRegistry( new IoCLicensingRegistry() );
}
);
Turns out that StructureMap does not puke when you use the DSL syntax in an incorrect manor. What it does do however is simply not wire up correctly, which makes sense.
Anyway, not that my head hurts, but my code is back to normal I guess it is time to move on to the next issue.
Till next time.
Posted
10-23-2009 6:40 AM
by
Derik Whittaker