Skip to content

Code coverage results don't include net462 TFMs #38

@geeknoid

Description

@geeknoid

In https://github.com/dotnet/extensions, the coverage report we are getting doesn't factor in data for the net462 TFM. We run our tests for a bunch of TFMs and the coverage report shows that the else branch of code that does:

#fi NETCOREAPP_3_1_OR_GREATER
// shows as covered
#else
// shows as not-covered
#endif

is not covered even though the tests definitely cover that code. I don't know if you have access to this, but here's a coverage report that shows this: https://dev.azure.com/dnceng-public/public/_build/results?buildId=336868&view=codecoverage-tab. The Redactor type in the Microsoft.Extensions.Compliance.Abstractions DLL in particular.

Is this is a known issue/limitation, or do we need to do something special to make this work?

Here's our config file in case that's the problem.

<?xml version="1.0" encoding="utf-8"?>
<Configuration>
  <Format>cobertura</Format>
  <CodeCoverage>

    <ModulePaths>
      <Include>
        <ModulePath>.*Microsoft.AspNetCore\.[^/\\]+\.dll$</ModulePath>
        <ModulePath>.*Microsoft.Extensions\.[^/\\]+\.dll$</ModulePath>
        <ModulePath>.*Microsoft.Gen\.[^/\\]+\.dll$</ModulePath>
        <ModulePath>.*System\.Cloud\.[^/\\]+\.dll$</ModulePath>
      </Include>
      <Exclude>
        <ModulePath>.*tests\.dll</ModulePath>
        <ModulePath>.*xunit.*</ModulePath>
        <ModulePath>.*moq.*</ModulePath>
      </Exclude>
    </ModulePaths>

    <!-- Match attributes on any code element: -->
    <Attributes>
      <Exclude>
        <!-- Don't forget "Attribute" at the end of the name -->
        <Attribute>^System\.Diagnostics\.DebuggerHiddenAttribute$</Attribute>
        <Attribute>^System\.Diagnostics\.DebuggerNonUserCodeAttribute$</Attribute>
        <Attribute>^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$</Attribute>
        <Attribute>^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$</Attribute>
      </Exclude>
    </Attributes>

    <!-- When set to True, dynamic native instrumentation will be enabled. -->
    <EnableDynamicNativeInstrumentation>false</EnableDynamicNativeInstrumentation>
    <!-- When set to True, instrumented binaries on disk are removed and original files are restored. -->
    <EnableStaticNativeInstrumentationRestore>false</EnableStaticNativeInstrumentationRestore>
    <EnableStaticNativeInstrumentation>false</EnableStaticNativeInstrumentation>
    <UseVerifiableInstrumentation>false</UseVerifiableInstrumentation>

  </CodeCoverage>
</Configuration>

Thanks.

@RussKie

AB#1866670

Metadata

Metadata

Assignees

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