Skip to content
This repository was archived by the owner on Dec 19, 2018. It is now read-only.
This repository was archived by the owner on Dec 19, 2018. It is now read-only.

ConfigureServices IServiceCollection exception message is confusing. #502

Closed
@JesperTreetop

Description

@JesperTreetop

The code calling ConfigureServices generates the following exception message:

ConfigureServices can take at most a single IServiceCollection parameter.

When I got this, I read this as "ConfigureServices can take various parameters, but just one of the type IServiceCollection, so you're trying to use two or more IServiceCollection parameters"! I had to go find the code where the exception was thrown to realize that it meant that it can't take any other parameters, which was my problem (trying to have IHostingEnvironment injected to set up services differently based on environment; I solved that by having the constructor, which can take it, squirrel away the IHostingEnvironment instance).

How about:

ConfigureServices can not take any parameters besides at most one IServiceCollection parameter.

..?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions