Skip to content

HTML logger LogFilePrefix collides with multiple projects during dotnet test #15074

Closed as not planned
@glen-nicol

Description

@glen-nicol

When running dotnet test solution.sln --logger:`"html;LogFilePrefix=<absolutepath>/tests/html/tests_results on a solution with multiple test projects I frequently get an error like this:

Html Logger Error : The process cannot access the file 'C:\git\project\artifacts\support\tests\tests\html\tests_results_net8.0_20250522131609.html' because it is being used by another process.

It seems multiple dotnet.exe are used to execute tests in parallel and some end up with the same timestamp in the filename

Process monitor shows the SHARING_VIOLATION occurs when a second dotnet.exe process tries to create a file during the same second as the first entry in the screenshot.
Image

Not shown: actually there are 4 dotnet exe's all trying to create the same file but I filtered the other 2 out for simplicity.

Seems that timestemp should be extended to include fractional seconds? Or better yet use the assembly name of the test project in the filename too? Nunit supports {assembly} and {framework} substitutions in its filename parameter which is nice but that would be more helpful in the LogFileName parameter of HTML logger.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions