Ok, so I am using both Automapper (LOVE it!) and ninject (very fond of it, but we have “issues” :-). I am writing MVC3 apps.
When I mess something up in Automapper configuration, Automapper goes to great lengths to tell me exactly what I did wrong, providing all necessary details.
When I mess something up in ninject configuration, it says “something is wrong”. Well, not even quite that. If I am lucky enough to have the output window open, I hopefully see a message fly by akin to “first chance exception ActivationException was thrown”. Thats it.
Not very helpful if you ask me…
Is there a way to get ninject to be a little more communicative? Right now, I have a list of things I check (make sure ctor is public, make sure the class implements all of the interface, etc etc).
Aha! Found the issue.
Turns out that I am using
TryGet(), which implicitly catches any exceptions ninject throws. This explains why although I saw a message about a first chance exception in the output log, but nothing was actually thrown.Switching over to using a
Get()lets the exception bubble up.Now theres a whole lotta love im gettin’ from ninject about the error in my ways ==> very useful diagnostic debug output.
Hope this helps another soul with the same confusion.