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

Disposing a container with no extensions causes a NullReferenceException #74

Closed
FodderMK opened this issue Feb 8, 2017 · 1 comment
Closed
Assignees
Labels
Milestone

Comments

@FodderMK
Copy link
Contributor

FodderMK commented Feb 8, 2017

The following code causes a NullReferenceException:

var injector = new InjectionContainer();
injector.Dispose();

This is caused by the foreach loop in InjectionContainer.cs line 146 trying to loop through a list that hasn't been initialized. This can be fixed either checking for a null list before looping or changing line 26 to read:

private List<IContainerExtension> extensions = new List<IContainerExtension>();
@intentor intentor self-assigned this Feb 10, 2017
@intentor intentor added this to the v2.24 milestone Feb 10, 2017
@intentor
Copy link
Owner

Thanks for the feedback, @FodderMK! It'll be on the next release!

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

No branches or pull requests

2 participants