Skip to content

NullReferenceException when null arguments are used in TestFixtureAttribute #1934

Description

@sir-wilhelm

This seems to be related to #1507. We started getting several errors after moving from 3.4 to 3.5. The errors can be seen in the Visual Studio test runner and the nunit3-console runner. The errors are all similar to the following:

1) Invalid : Tests.Controls.iBus.When_the_passed_in_domain_is_null
An exception was thrown while loading the test.
System.NullReferenceException: Object reference not set to an instance of an object.
   at NUnit.Framework.Internal.Builders.DefaultSuiteBuilder.HasArguments(IFixtureBuilder attr)
   at NUnit.Framework.Internal.Builders.DefaultSuiteBuilder.GetFixtureBuilderAttributes(ITypeInfo typeInfo)
   at NUnit.Framework.Internal.Builders.DefaultSuiteBuilder.BuildFrom(ITypeInfo typeInfo)

This is one example of the test fixtures/constructors that are failing again:

[TestFixture(null)]
[TestFixture("")]
[TestFixture(" ")]
[TestFixture("\t")]
public class When_the_passed_in_domain_is_null : BasePresenterTest
{
    private readonly string _domain;

    public When_the_passed_in_domain_is_null(string domain)
    {
        _domain = domain;
    }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions