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

dotnetjunkie opened this issue Apr 28, 2019 · 1 comment


None yet
1 participant
Copy link

commented Apr 28, 2019

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.


This comment has been minimized.

Copy link
Collaborator Author

commented Apr 29, 2019

bug-695 branch created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.