Repository navigation
Avoid code coverage artifacts overwriting publish files - #8346
dsplaisted wants to merge 3 commits into
Conversation
Skip code coverage artifacts whose publish-relative path is already owned by ResolvedFileToPublish, while preserving unique collector artifacts. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 5058191f-b8c2-493e-96fd-07c5ee938a1b
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Run the synthetic project through the installed MSBuild toolset so the standard Copy task is registered without adding Microsoft.Build.Tasks.Core and its vulnerable transitive dependency. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 1031e116-e457-42a0-9c9c-828732a012dd
Run the synthetic publish project through AcceptanceTestBase so the regression uses the repository's temporary-directory, patched-dotnet, process timeout, and output-capture conventions. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 1031e116-e457-42a0-9c9c-828732a012dd
@omajid this sounds quite similar to NuGet/Home#15050 which was triggered by the deterministic pack timestamp changes. I wonder if we should make that part opt-in instead. |
|
Yes, we seem to be running into too many unexpected regressions. |
|
@omajid are you going to open a nuget-client PR? |
|
@dotnet/dotnet-testing-admin Thoughts on this? It looks like the issue was exposed by deterministic timestamps in NuGet packages, but there probably needs to be a fix in how the code coverage targets copy dependencies. |
|
@fhnaseer please have a look on this code coverage issue. |
|
@nohwnd Can you make the changes in this pr directly to vstest? |
Sorry, I was swamped with other things. |
|
given deterministic pack was disabled by default again (NuGet/NuGet.Client#7652) we don't need this anymore. |
Fix issue that surfaced in dotnet/sdk#55754. During publish,
Microsoft.CodeCoverage.targetsreplaced application assemblies—especiallySystem.Text.Json10.0.0.11 andSystem.Memory4.0.5.0—with older CodeCoverage-private copies (6.0.0.0 and 4.0.1.1). This caused assembly loading failures in the net472 tests. For example:It looks like previously a subsequent publish copy with _CopyResolvedFilesToPublishPreserveNewest would overwrite the older files from the code coverage package, but now the code coverage package ended up with newer timestamps on the older assemblies, leading to this issue.
Description
Microsoft.CodeCoverage.targetscopied the entire collector tree afterComputeFilesToPublish, allowing collector dependencies such asSystem.Memory.dllto overwrite application-owned publish files. This change assigns collector artifacts their publish-relative paths and removes any path already owned byResolvedFileToPublishusing path-like metadata matching, while continuing to publish unique collector artifacts.A focused regression test executes the packaged target with an intentionally newer colliding collector file. It verifies that the application-owned file wins regardless of timestamps and that a unique nested coverage artifact is still copied.