openshac
openshac

Reputation: 5165

NUnit3TestExecutor throwing an ArgumentNullException - Value cannot be null

I am using Azure DevOps for our CI/CD pipeline. The Visual Studio Test task on the Agent Job has suddenly started failing.

The error in the logs is:

An exception occurred while invoking executor 'executor://nunit3testexecutor/': Value cannot be null. (Parameter 'type')

The task is defined as follows:

steps:
- task: VSTest@2
  displayName: 'VsTest - testAssemblies'
  inputs:
    testAssemblyVer2: |
     **\*Tests.dll
     !**\*TestAdapter.dll
     !**\obj\**
     !**\bin\**\ref\**
    testFiltercriteria: 'FullyQualifiedName!~XXX.IntegrationTests'
    otherConsoleOptions: '/framework:".NETCoreApp,Version=v5.0"'

I have had a look at the NUnit3TestExecutor source code but I can't see a method with a parameter called 'type'.

The only place I can this parameter is in the System.Attribute (CoreCLR) class which NUnitAttribute inherits from:

public static Attribute[] GetCustomAttributes(MemberInfo element, Type type, bool inherit)
{
    ...

    if (type == null)
        throw new ArgumentNullException(nameof(type));
    ...
}

Is there a reason why the test executor would suddenly start failing?

Upvotes: 1

Views: 790

Answers (1)

openshac
openshac

Reputation: 5165

Solved this by modifying the Azure Pipeline to clean the build directories.

Go to: Pipeline > Get sources > Clean options

Set this to value 'All build directories'.

Upvotes: 1

Related Questions