Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide good feedback when providers don't implement services #7469

Closed
ajcvickers opened this issue Jan 24, 2017 · 4 comments
Closed

Provide good feedback when providers don't implement services #7469

ajcvickers opened this issue Jan 24, 2017 · 4 comments
Labels
area-test closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Milestone

Comments

@ajcvickers
Copy link
Member

Prior to #7464, providers used a base class as a guide for which services to implement. Services for which there were no defaults had abstract members in the base class, which meant a provider could not ship without having some implementation for all required services.

Post #7464, there is no base class. This means that there is nothing forcing providers to implement required services. If provider doesn't implement a required service, then the application is likely to crash at some point with an unhelpful message from D.I. It would be better if there was some mechanism to either force providers to implement all required services or throw a more helpful message when a service is not implemented.

@ErikEJ
Copy link
Contributor

ErikEJ commented Jan 24, 2017

Could the specification tests help with this?

@ajcvickers
Copy link
Member Author

@ErikEJ Yes, that is one of the things we have talked about. But I think we can also do more.

@ajcvickers
Copy link
Member Author

Discussed in the design meeting and decided:

  • Will add test to the specification test focused on this.
  • Will not at this time add default implementations that throw
  • Will not at this time do automatic validation on service collections
  • Will not at this time add other runtime validation that can be called by anyone

@ajcvickers ajcvickers self-assigned this Jan 26, 2017
@ajcvickers ajcvickers added this to the 2.0.0 milestone Jan 26, 2017
@ajcvickers ajcvickers modified the milestones: 2.0.0-preview1, 2.0.0 Apr 19, 2017
@ajcvickers
Copy link
Member Author

See also the discussion here: #8818

ajcvickers added a commit that referenced this issue Jul 6, 2017
Issue #7469

* Specification tests added to be run by providers to ensure all services are registered with the correct scope.
* Updated many functional tests to build the service provider using scope validation. (Better done like this than in a single test, since it makes it more likely all services will be covered.)
* Fixed some places where dependency objects were registered with the wrong scope.
ajcvickers added a commit that referenced this issue Jul 7, 2017
Issue #7469

* Specification tests added to be run by providers to ensure all services are registered with the correct scope.
* Updated many functional tests to build the service provider using scope validation. (Better done like this than in a single test, since it makes it more likely all services will be covered.)
* Fixed some places where dependency objects were registered with the wrong scope.
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jul 7, 2017
@ajcvickers ajcvickers removed their assignment Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-test closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Projects
None yet
Development

No branches or pull requests

2 participants