Skip to content

Commit 69270ff

Browse files
authored
Add analyzer assemblies to code coverage (#60859)
* Add analyzer assemblies to code coverage Instrument analyzer assemblies as well when measuring code coverage. Filter out the ones which aren't referenced via the P2P protocol. * Update coverage.targets
1 parent a53e68e commit 69270ff

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

eng/testing/coverage.targets

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<Project>
2-
<Target Name="SetupCoverageFilter">
2+
<Target Name="SetupCoverageFilter"
3+
DependsOnTargets="ResolveReferences">
34
<!--
45
We need to filter the data to only the assembly being tested. Otherwise we will gather tons of data about other assemblies.
56
If the code being tested is part of the runtime itself, it requires special treatment.
@@ -18,6 +19,8 @@
1819
<CoverageInclude Include="System.Private.CoreLib" Condition="'$(TestRuntime)' == 'true'" />
1920
<CoverageInclude Include="@(AssembliesBeingTested)" />
2021
<CoverageInclude Include="$(CoverageAssemblies)" Condition="'$(CoverageAssemblies)' != ''" />
22+
<!-- Include analyzer assemblies which are referenced via the P2P protocol. -->
23+
<CoverageInclude Include="@(ReferencePath->WithMetadataValue('OutputItemType', 'Analyzer')->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference')->Metadata('Filename'))" />
2124
</ItemGroup>
2225

2326
<PropertyGroup>

0 commit comments

Comments
 (0)