Skip to content
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 opened this issue Nov 24, 2015 · 8 comments
Closed
Assignees
Milestone

Comments

@JesperTreetop
Copy link

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.

..?

@davidfowl
Copy link
Member

besides at most one IServiceCollection parameter

Is confusing as well. I'm all for changing it to be clearer though.

/cc @Eilon

@Eilon
Copy link
Member

Eilon commented Nov 24, 2015

I'll come up with something.

@Eilon Eilon added this to the 1.0.0-rc2 milestone Nov 24, 2015
@Eilon Eilon self-assigned this Nov 24, 2015
@muratg muratg modified the milestones: 1.0.0, 1.0.0-rc2 Apr 1, 2016
@muratg muratg assigned davidfowl and unassigned Eilon May 19, 2016
@davidfowl davidfowl assigned Eilon and unassigned davidfowl May 20, 2016
@davidfowl
Copy link
Member

@Eilon last chance 😄

@JunTaoLuo
Copy link
Contributor

"ConfigureServices must be parameterless or take only one IServiceCollection parameter."?

@Eilon
Copy link
Member

Eilon commented May 20, 2016

Slight modification @JunTaoLuo 's text:

The ConfigureServices method must either be parameterless or take only one parameter of type IServiceCollection.

@Eilon Eilon removed their assignment May 20, 2016
@Eilon
Copy link
Member

Eilon commented May 20, 2016

Unassigning from me. @muratg can find a new owner to implement this complex feature 😄

@JesperTreetop
Copy link
Author

Thanks for listening and caring about things like this. I know it would have been very easy to swat it away and say "nah, you just weren't thinking". I think the message you settled on was great and better than my proposal.

@Eilon
Copy link
Member

Eilon commented May 24, 2016

@JesperTreetop of course, and thanks for bringing it to our attention!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants