Skip to content

Unable to disable determistic source mapping in Microsoft.CodeCoverage #5178

@bh-sijtnic

Description

@bh-sijtnic

Description

After upgrading our build tools to 17.10, we started seeing .msCoverageSourceRootsMapping_testassembly files in a subfolder of our output folder.
We managed to trace these files back to the Microsoft.CodeCoverage package, where the MsCoverageReferencedPathMaps target was introduced.
#4849

This target always runs when build, it does not allow the user to disable it.

  1. Why are these files needed during the build if code coverage is not required? I don't want them if they are not needed.
  2. The location where the files are stored cannot be controlled. In our environment, the files appear in a strange location "bin\debug\net6.0-windows10.0.19041\net6.0-windows10.0.19041\win-x64", while the test assembly itself is in "bin\debug\net6.0-windows10.0.19041". Not sure why the files end up in the wrong subfolder... looking at the code it should be using $(OutputPath). It would be good to add the option to override this path.
  3. Nowhere in the (normal verbosity) build logs i could these files being generated.
  4. We dont even use the Microsoft.CodeCoverage NuGet package. Which package pulls this in?

Steps to reproduce

Create a class library and a unit test project with a test. Build the projects and notice the .msCoverageSourceRootsMapping_TestProject2 being generated in the output folder.

Expected behavior

  1. I expect properties are available that allow me to disable this functionality
  2. I expect i have the option to set a property to override the rootPath used to write these files
  3. I expect the tasks have some output to the log files
  4. I dont even expect the Microsoft.CodeCoverage NuGet package to be used, it is not visible in my Visual Studio solution explorer

Actual behavior

Undesired files are written and i have no way to monitor and control this.

Environment

We have multiple .NET projects using

  • Visual Studio 2022 LTSC 17.10

  • .NET 6 SDK 6.0.424

  • Relevant packageReferences

      <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
      <PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
      <PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
    

image

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