Skip to content

HtmlReporter state is not scoped per session when sessions overlap #7298

Closed

Description

@thomhurst

Problem

HtmlReporter keeps all its state in fields shared by every session in the process, with no session key:

  • _updates (src/TUnit.Engine/Reporters/Html/HtmlReporter.cs:40) is one ConcurrentDictionary<string, TestNodeUpdateMessage>.
  • OnTestSessionStartingAsync clears it (HtmlReporter.cs:124), and BuildReportData renders all of it (HtmlReporter.cs:613-614).

When MTP server mode runs two sessions in one process at the same time, the second session's start wipes the first session's results. Each report can also contain the other session's tests. The unobserved task exception queue added in #7296 follows the same scoping.

Raised during review of #7296 (#7296 (comment)).

Expected

Either key the reporter state (updates, unobserved exceptions, activity collection) by SessionUid and build each report from its own session's entries, or document that the HTML report assumes sessions do not overlap.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium: edge case, mode divergence, flaky test, or workaround existsbugSomething isn't workingin-progressWork is in progress

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions