镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

RegisterInstance() throws incorrect exception #351

Open

Description

@ENikS

RegisterInstance(...)

The method is defined by IUnityContainer as the following:

IUnityContainer RegisterInstance(Type type, string name, object instance, IInstanceLifetimeManager lifetimeManager);

Registered Type

Registration Type is determined either by explicit parameter type, or implicitly from type of the instance. When method RegisterInstance(...) is called with both type and instance as null` exception is thrown.

Exception

By convention, when argument is null, exception System.ArgumentNullException should be thrown. Instead, Unity throws System.InvalidOperationException

Solution

Unity must throw correct exception: System.ArgumentNullException

Activity

  1. self-assigned this
    on Jun 27, 2021
  2. added a commit that references this issue on Jun 27, 2021
    e3300c6
  3. added a commit that references this issue on Jun 27, 2021
    56dba7c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions