Skip to content

Only the first throwing data source of a test method is reported #7884

Backlog

Description

@thomhurst

Summary

When a test method has two data sources that both throw, only the first failure is reported, in both discovery modes. The second source's failure never appears, so fixing the first one reveals the second only on the next run.

Reproduction

public class TwoThrowingSourcesTests
{
    public static IEnumerable<int> First() => throw new InvalidOperationException("first");
    public static IEnumerable<int> Second() => throw new InvalidOperationException("second");

    [Test, MethodDataSource(nameof(First)), MethodDataSource(nameof(Second))]
    public void Run(int value) { }
}

Run with --treenode-filter "/*/*/TwoThrowingSourcesTests/*", once as is and once with --reflection added.

Expected and actual

  • Expected: two failed tests, one per source, the second reporting InvalidOperationException: second.
  • Actual: in both modes there is one test, which fails with first (wrapped in TargetInvocationException in reflection mode). Building the method's tests stops at the first source that throws.

Environment

origin/main 01c0862, .NET SDK from global.json, net10.0, macOS arm64. Found while working on #7883.

Should each data source that throws produce its own failed test?

Activity

  1. added
    bug
    P3
    on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions