Skip to content

Constructor arguments should be nullable #1494

Closed
@qrjo

Description

The constructor arguments that are passed to a mocked class' constructor are now typed as object[], this causes a lot of unwarranted warnings when passing null, because the mocked class in question might actually allow null for its arguments. The type should be changed to object?[].

I'm running into this problem when constructing Mock:

public Mock(params object[] args)
public Mock(MockBehavior behavior, params object[] args)

These should be changed to:

public Mock(params object?[] args)
public Mock(MockBehavior behavior, params object?[] args)

Back this issue
Back this issue

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions