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

GetRegistration and GetService methods lack null check #695

Closed
dotnetjunkie opened this issue Apr 28, 2019 · 1 comment
Closed

GetRegistration and GetService methods lack null check #695

dotnetjunkie opened this issue Apr 28, 2019 · 1 comment
Milestone

Comments

@dotnetjunkie
Copy link
Collaborator

Some methods on the public API of Container lack a proper null check when the supplied Type (serviceType) is a null reference. Those methods are:

  • GetRegistration(Type serviceType, bool throwOnFailure)
  • IServiceProvider.GetService(Type serviceType)

Those methods will eventually fail with a NullReferenceException, but they will do so with an exception mentioning the key argument, as Type is supplied to the dictionary's TryGetValue method.

Better solution is to check for null instead.

@dotnetjunkie
Copy link
Collaborator Author

bug-695 branch created.

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

No branches or pull requests

1 participant