CanResolve returns false for arbitrary types that can resolve


Because CanResolve returns false even when a non-registered concrete class could be resolved because all of its constructor dependencies are registered, I can't use CanResolve in place of a try/catch. Try/catch is obviously much slower than a spot check for all the other cases where Munq will throw when it can't resolve. We need either CanResolve to return true when a concrete type that isn't registered can resolve by dependency, or a TryResolve method that will attempt to resolve without throwing an exception.


Crenna wrote Oct 28, 2012 at 5:06 PM

I've forked a default implementation which includes both CanResolve returning true when Munq can, in fact, resolve an arbitrary type, as well as suppressing all exceptions. I realize exceptions are informative for long dependency graphs, but for high performance applications and in MVC/Web API where default resolutions routinely fallback on null, it's not acceptable. My version of Munq with these edits lives here: https://github.com/danielcrenna/container.

wrote Feb 14, 2013 at 3:01 AM