Skip to content

bug: DependsOnConflictAnalyzer only reports first dependency cycle #4862

@thomhurst

Description

@thomhurst

Description

File: TUnit.Analyzers/DependsOnConflictAnalyzer.cs (Lines 121-142)

The method returns immediately when it detects the first cycle in the dependency graph:

if (chain.MethodTraversed(foundDependency))
{
    chain.Add(foundDependency);
    return chain;  // Returns immediately — misses other cycles
}

If a dependency graph has multiple cycles, only the first one is reported. Users must fix one cycle, rebuild, and discover the next one iteratively.

Suggested Fix

Continue processing all dependencies and accumulate all cycles before returning, so all cycles are reported at once.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions