Skip to content

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

Closed as not planned

Description

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.

Activity

  1. nohwnd commented on May 23, 2025

    @nohwnd
    Member

    Ideally this would be solved by templates in the file name like .html, but we don't have that and we are not adding new features here.

    #5132 (comment) you could probably work around this by setting the report name based on the project directly from the project file, using the variables you have there.

  2. glen-nicol commented on May 23, 2025

    @glen-nicol
    Author

    Got it, I will try that. Thanks!

  3. nohwnd commented on Jun 12, 2025

    @nohwnd
    Member

    This would require a new feature and has a known workaround, closing.

  4. christopher-watanabe-snkeos commented on Mar 17, 2026

    @christopher-watanabe-snkeos

    I've also just found that I'm affected by this unfortunately. Glen Nicol (@glen-nicol): Did you happen to try the suggested workaround with any success?

  5. glen-nicol commented on Mar 17, 2026

    @glen-nicol
    Author

    I don't remember if I tried it or not but I ended up removing the html logger argument and then I used the jenkins nunit plugin to format the nunit xml file for CI jobs. No local html file but I imagine I could hook up some nunit report generator if I really needed to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions