Skip to content

Extensions are no longer loading as is currently documented #1613

@mmalandra-kb4

Description

@mmalandra-kb4

NUnit Engine/API versions 3.19.1.

How should extensions be loaded now? With the latest nunit-console (3.19.1) and engines/api, our extensions are no longer loading.

From the source code, you can see a major change here where the code is only looking at specific folders that match hardcoded patterns:

public void FindExtensionAssemblies(Assembly hostAssembly)
{
    log.Info($"FindExtensionAssemblies called for host {hostAssembly.FullName}");

    bool isChocolateyPackage = System.IO.File.Exists(Path.Combine(hostAssembly.Location, "VERIFICATION.txt"));
    string[] extensionPatterns = isChocolateyPackage
        ? new[] { "nunit-extension-*/**/tools/", "nunit-extension-*/**/tools/*/" }
        : new[] { "NUnit.Extension.*/**/tools/", "NUnit.Extension.*/**/tools/*/" };


    IDirectory startDir = _fileSystem.GetDirectory(AssemblyHelper.GetDirectoryName(hostAssembly));

    while (startDir != null)
    {
        foreach (var pattern in extensionPatterns)
            foreach (var dir in _directoryFinder.GetDirectories(startDir, pattern))
                ProcessDirectory(dir, true);

        startDir = startDir.Parent;
    }
}

Does the documentation around loading extensions need to be updated, or is there a way to get engine to allow for other folders to contain extensions?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions