Skip to content

Coverlet Tracker Missing CompilerGeneratedAttribute #1828

Closed

Description

@Werebunny

Describe the bug
The generated coverage tracker is no longer (or never actually was) marked with the CompilerGeneratedAttribute.

To Reproduce
Here's a sample test that'll fail. Replace 'typeof(ToolSet)' with your own and use whatever test framework you wish:

[Fact]
internal static void FindCoverletTrackerIssue()
{
    Type tracker = Assembly
        .GetAssembly(typeof(ToolSet))
        .GetTypes()
        .Single(t =>
            t.Namespace?.StartsWith(
                "Coverlet.Core.Instrumentation.Tracker",
                StringComparison.Ordinal
            ) ?? false
        );
    tracker.IsDefined(typeof(CompilerGeneratedAttribute), false).Assert().Is(true);
}

Expected behavior
This test should pass. Setting 'true' for inherited attributes doesn't change the result.

Actual behavior
The test fails. In fact, the generated static class "Coverlet.Core.Instrumentation.Tracker.{assemblyName}_{guid}" contains no defined custom attributes.

Configuration (please complete the following information):
Coverlet version: 8.0.0 (bug also found on 6.0.4) via dotnet test --collect:"XPlat Code Coverage"
Library .NET versions: .NET 10 and .NET Standard 2.0
Test .NET versions: .NET 10, .NET 9 and .NET 4.8
OS: Mac and Windows Server 2025

Additional context
The CompilerGeneratedAttribute was supposedly added as part of #1229 due to issue #1191.
It is not clear to me that this change ever actually added the CompilerGeneratedAttribute to the resulting created Tracker however.

❗ Please also read Known Issues

Activity

  1. Bertk commented on Apr 16, 2026

    @Bertk
    Collaborator

    Please note: the CompilerGeneratedAttribute is still in the source file.

  2. added
    question
    and removed
    untriaged
    on Apr 16, 2026
  3. changed the title [-][BUG] Coverlet Tracker Missing CompilerGeneratedAttribute[/-] [+]Coverlet Tracker Missing CompilerGeneratedAttribute[/+] on Apr 21, 2026
  4. added
    waiting for customer
    bug
    Solved
    and removed
    question
    waiting for customer
    on May 7, 2026
  5. Bertk commented on May 16, 2026

    @Bertk
    Collaborator

    Solved with PR #1904

  6. 40 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Solvedbugcoverlet-core

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions