Skip to content

Coverage reports collide across test projects with relative --coverage-output (regression in 18.9.0) #226

Closed

Description

Upgrading from 18.8.0 to 18.9.0, multiple test projects in one dotnet test
solution run now write coverage to the same shared TestResults folder instead
of their own project folder. With a relative --coverage-output path, they
overwrite each other and coverage data is lost.

Cause: transitively bumps Microsoft.Testing.Platform 2.2.3 → 2.3.0, which now
honors DOTNET_CLI_TEST_COMMAND_WORKING_DIRECTORY (set by dotnet test to the
solution root) when resolving the results directory.

Minimal repro attached (repro.zip): two independent test projects, run.ps1
runs both versions and reports the coverage file count.

  • 18.8.0: 2 coverage files (one per project) — correct
  • 18.9.0: 1 file — projects clobbered each other

Expected: each project gets its own report regardless of that env var.

Env: .NET SDK 10.0.301, Microsoft.Testing.Platform (MTP), xUnit v3, Windows 11.

Activity

  1. dorssel commented on Jul 9, 2026

    @dorssel

    I noticed the same. But the change is really, that everything now ends up in a single .\TestResults folder. And if you use --coverage-output, then that is what makes them overwrite each other.

    So, (as I understand it):

    • Old behavior (<= 18.8.0): each result ended up in a separate directory and setting for example --coverage-output coverage.cobertura.xml would name both files the same, but in different directories.
    • New Behavior (>= 18.9.0): each result ends up in the same directory (configurable with --results-directory), but with different file names (unless configured with --coverage-output.

    In any case. The problem happens if you use both --coverage-output and you have multiple test projects.

  2. dorssel commented on Jul 9, 2026

    @dorssel

    Exactly this commit is what fixed it for me: dorssel/dotnet-debounce@07e26d3

  3. fhnaseer commented on Jul 10, 2026

    @fhnaseer
    Member

    I noticed the same. But the change is really, that everything now ends up in a single .\TestResults folder. And if you use --coverage-output, then that is what makes them overwrite each other.

    So, (as I understand it):

    • Old behavior (<= 18.8.0): each result ended up in a separate directory and setting for example --coverage-output coverage.cobertura.xml would name both files the same, but in different directories.
    • New Behavior (>= 18.9.0): each result ends up in the same directory (configurable with --results-directory), but with different file names (unless configured with --coverage-output.

    In any case. The problem happens if you use both --coverage-output and you have multiple test projects.

    Yes, this is the new behavior. If you run dotnet test something.slnx --report-trx --report-trx-filename anything.trx and it will yield the same result as well.

    Update: Xunit's own trx reporter also faces similar issue with dotnet test something.slnx --report-xunit-trx --report-xunit-trx-filename', 'something.trx.

  4. tsondergaard commented on Jul 10, 2026

    @tsondergaard
    Author

    fhnaseer, so this behaviour change is here to stay? --coverage-output seems like a dangerous option with the new behaviour.

  5. fhnaseer commented on Jul 10, 2026

    @fhnaseer
    Member

    You can still do mtp.test1.exe --coverage --coverage-output something.coverage for a deterministic output.

    MTP introduced placeholder names (not supported in coverage extension though yet) to have deterministic names on solution level https://learn.microsoft.com/en-us/dotnet/core/testing/microsoft-testing-platform-test-reports#report-file-names.

  6. tsondergaard commented on Jul 13, 2026

    @tsondergaard
    Author

    Okay, it's intentional. I'll close the issue then.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions