1

Closed

IDependencyScope minor doc issue

description

Both GetService() and GetServices() state in their documentation "Must never throw":
    /// Gets an instance of the given <paramref name="serviceType"/>. Must never throw.
This seems inaccurate, there are a few situations in which throwing from one of these methods might be appropriate:
  • ArgumentNull - if the serviceType parameter is null then the resolver should probably throw
  • Misconfigured dependency resolver - e.g. if the serviceType is available but can't be constructed; this is a fail-fast that helps catch configuration issues
  • OutOfMemory/StackOverflow/AccessViolationException etc. (runtime exceptions)
The full intent of the statement is probably related to the returning null/empty in the case of being unable to service the request, so I would suggest: "Should not throw when a service is unavailable".

Minor related item:

GetServices() documentation includes the following misspelling of 'instances':
    /// <returns>A sequence of isntances of the requested <paramref name="serviceType"/>. The sequence
Closed Jul 19, 2012 at 12:36 AM by hongyes