Skip to content

NullReferenceException when [TestFixtureSource] refers to data in a generic class. #1346

Closed
@yaakov-h

Description

@yaakov-h

NUnit output:

Executing: C:\Tools\NUnit3\bin\nunit3-console.exe
NUnit Console Runner 3.0.5813 
Copyright (C) 2015 Charlie Poole

Runtime Environment
   OS Version: Microsoft Windows NT 6.3.9600.0
  CLR Version: 4.0.30319.42000

Test Files
    ValveKeyValue/ValveKeyValue.Test/bin/Release/ValveKeyValue.Test.dll


Errors and Failures

1) Invalid : ValveKeyValue.Test.ArrayTestCase<TEnumerable>
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.NUnitTestFixtureBuilder.BuildFrom(ITypeInfo typeInfo, ITestFixtureData testFixtureData)
   at NUnit.Framework.TestFixtureSourceAttribute.<BuildFrom>d__17.MoveNext()
   at NUnit.Framework.Internal.Builders.DefaultSuiteBuilder.BuildFrom(ITypeInfo typeInfo)

2) Invalid : ValveKeyValue.Test.TopLevelEnumerableTestCase<TEnumerable>
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.NUnitTestFixtureBuilder.BuildFrom(ITypeInfo typeInfo, ITestFixtureData testFixtureData)
   at NUnit.Framework.TestFixtureSourceAttribute.<BuildFrom>d__17.MoveNext()
   at NUnit.Framework.Internal.Builders.DefaultSuiteBuilder.BuildFrom(ITypeInfo typeInfo)

Run Settings
    WorkDirectory: C:\projects\valvekeyvalue
    NumberOfTestWorkers: 2

Test Run Summary
    Overall result: Failed
   Tests run: 85, Passed: 85, Errors: 0, Failures: 0, Inconclusive: 0
     Not run: 0, Invalid: 0, Ignored: 0, Explicit: 0, Skipped: 0
  Start time: 2016-03-13 09:36:40Z
    End time: 2016-03-13 09:36:41Z
    Duration: 1.241 seconds

Full build process output is available at https://ci.appveyor.com/project/xPaw/valvekeyvalue/build/1.0.0.20-AppVeyor#L60

Seemingly, nunit3-console returns a status code of 0. I'd expect in a failure case such as this, it would return non-zero.

Code that causes this issue:

[TestFixtureSource] here: https://github.com/SteamDatabase/ValveKeyValue/blob/dc20dcde8d4efddfcc0ed7730fd693563401300a/ValveKeyValue/ValveKeyValue.Test/Text/ArrayTestCase.cs#L7
Points to this collection here: https://github.com/SteamDatabase/ValveKeyValue/blob/dc20dcde8d4efddfcc0ed7730fd693563401300a/ValveKeyValue/ValveKeyValue.Test/TestFixtureSources.cs#L9

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions