Derik Whittaker

Syndication

News


Can anyone spot what is wrong here?

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

[Advertisement]

Comments

jdn wrote re: Can anyone spot what is wrong here?
on 10-24-2009 3:16 PM

Sheer co-incidence but that's the second post in two days about this downside to using a DSL.

It's hard to write a DSL that is flexible but will still throw on improper ordering.

Derik Whittaker wrote re: Can anyone spot what is wrong here?
on 10-24-2009 7:46 PM

@JDN,

What other post as talking about dsl's?

jdn wrote re: Can anyone spot what is wrong here?
on 10-27-2009 11:45 AM
Scott Koon wrote re: Can anyone spot what is wrong here?
on 11-07-2009 1:00 PM

Why didn't you just check the file out of Subversion to a different directory so you could do the compare?

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)