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

Improve exception message when RegisterCollection is called twice #378

Closed
dotnetjunkie opened this Issue Feb 14, 2017 · 0 comments

Comments

1 participant
@dotnetjunkie
Collaborator

dotnetjunkie commented Feb 14, 2017

When RegisterCollection is called twice for the same collection type, Simple Injector throws the following message:

Collection of items for type XXX has already been registered and the container is currently not configured to allow overriding registrations. To allow overriding the current registration, please create the container using the constructor overload that takes a ContainerOptions instance and set the AllowOverridingRegistrations property to true.

The exception message doesn't explain that in case the user wants to append items to the current registration, he should call AdvancedExtensions.AppendToCollection.

@dotnetjunkie dotnetjunkie added this to the v4 milestone Feb 14, 2017

@dotnetjunkie dotnetjunkie self-assigned this Feb 28, 2017

@dotnetjunkie dotnetjunkie removed the question label Feb 28, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment