A Brilliant Diagnostic in Castle Windsor

I’m not massively fond of Castle’s diagnostics.  There’s certainly no general framework such as StructureMap has: you just ask for something and wait for the inevitable exceptions.  However, the guy who wrote this bit of code for PerWebRequestLifestyle will be bought a drink if I ever meet him:

image

It’s amazing how often people will write FAQs explaining obscure error messages when sticking the diagnostics directly into the code would be more convenient, both for them, and the users.

Technorati Tags: Diagnostics,Castle Windsor

Published by

Julian Birch

Full time dad, does a bit of coding on the side.

One thought on “A Brilliant Diagnostic in Castle Windsor”

  1. I know you can validate things by actually trying out the configuration, but it fails in two major cases:1. Where you don’t want to create the object yet. e.g. because it connects to a system that isn’t ready on Start2. Where you want to verify that on object is missing specific dependencies and no others. This is vital for using the container in abstract factory scenarios.To deal with that, you really need StructureMap style introspection, but that’s hard in that you’d have to change the IHandler interface at least to support it. (I think, you may correct me on this…)Still, the diagnostic in the image is a superb bit of work.I’ll try to knock together a patch for the incorrect interceptor missing a dependency diagnostic, though. 🙂

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s