Skip to content

xUnit tests may not be discovered now that the .NET SDK trims packages from deps.json when they don't have any assets #49248

@dsplaisted

Description

@dsplaisted

The changes in #46218 can break xUnit tests, causing them to not be discovered at all.

This was found and documented here: dotnet/aspnetcore#62223

The issue is that xUnit looks for libraries nanmed "xunit" or "xunit.core" in the deps.json when trying to figure out whether an assembly is an xUnit test assembly. The xunit.core package doesn't include any runtime assets, only MSBuild .props and .targets files that are imported. This means that it may be removed from the deps.json file.

The xunit.core package depends on xunit.extensibility.core and xunit.extensibility.execution, both of which do have runtime assets. So if there are not references to those packages via another path, then the SDK will keep xunit.core in the deps.json. However, if there are other libraries that depend on xunit.extensibility.core and xunit.extensibility.execution, then the SDK will drop xunit.core from the deps.json and xUnit won't discover any tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions