Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Microsoft.CodeCoverage expected behavior with MSBuild /p:CreateHardLinksForCopyLocalIfPossible=true #118

Closed
Cjewett opened this issue Apr 19, 2024 · 2 comments

Comments

@Cjewett
Copy link

Cjewett commented Apr 19, 2024

I also posted this question in Coverlet (coverlet-coverage/coverlet#1651) because our company currently uses both Coverlet and Microsoft.CodeCoverage. There is a desire to turn on CreateHardLinksForCopyLocalIfPossible to reduce the size of our build output because we're running out of storage. When using Coverlet it hits System.IO.Exception TestProject.dll cannot be accessed because it is being used by another process. That is expected considering how code coverage normally works due to instrumentation, but I'm hoping this case has been handled in the official Microsoft solution. A couple questions:

  • Is Microsoft.CodeCoverage expected to work with builds that had hardlinks enabled if the test projects are run in parallel after compilation has completed?
  • If it is not expected to work are there workarounds to get it to work?
@jakubch1
Copy link
Member

Microsoft.CodeCoverage supports dynamic instrumentation which will work the best in this scenario:
https://github.com/microsoft/codecoverage/blob/main/docs/instrumentation.md#static-and-dynamic-instrumentation
Dynamic instrumentation is not modifying files on disk so parallel run should be possible.

Static instrumentation is enabled by default on non-Windows envs. Add <EnableStaticManagedInstrumentation>True</EnableStaticManagedInstrumentation> to your config to disable it.

@Cjewett
Copy link
Author

Cjewett commented Apr 19, 2024

Thanks for the quick reply @jakubch1 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants