question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Release 4.8.6 does not produce accurate coverage reports for generic classes anymore

See original GitHub issue

As of the latest release of the global tool (4.8.6), reports generated for generic classes are no longer accurate.

Console output of ReportGenerator: 2021-03-04T10:59:40: Arguments 2021-03-04T10:59:40: -reports:D:\GitSrc1\common\Common.Data\Coverage\Temp*\coverage.cobertura.xml 2021-03-04T10:59:40: -reporttypes:HtmlInline_AzurePipelines_Dark 2021-03-04T10:59:40: -targetdir:D:\GitSrc1\common\Common.Data\Coverage 2021-03-04T10:59:40: -assemblyfilters:-.Tests 2021-03-04T10:59:40: -filefilters:-*.g.cs 2021-03-04T10:59:42: Writing report file ‘D:\GitSrc1\common\Common.Data\Coverage\index.html’ 2021-03-04T10:59:43: Report generation took 2.9 seconds

It looks like all classes with generic type parameters are affected by this. However, the below minimal class and test easily show the problem too:

public class GenericClass<T>
{
    public string GetType()
    {
        return typeof(T).FullName;
    }
}
using Xunit;

public class GenericClassTests
{
    [Fact]
    public void ItWorks()
    {
        Assert.Equal("System.Int32", new GenericClass<int>().GetType());
    }
}

While the test does succeed and clearly covers the code, the generated report does report 0 uncovered lines, but also reports 0 covered lines which is clearly wrong.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
danielpalmecommented, Mar 4, 2021

Sorry for that. I fixed it in release 4.8.7.

1reaction
danielpalmecommented, Apr 3, 2022

@rzikm I improved the filtering in release 5.1.4.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolved - Code coverage doesn't work with generics
As a temporary workaround, you can downgrade to 1.1.1 which doesn't have this issue and will show correct coverage for generic methods.
Read more >
Resolved - How to use code coverage with C# generics
What I'm trying to do is check the code coverage on a generic C# class or method. But the generic method or class...
Read more >
Coverage is missing a class that was in fact tested #193
I ran into a strange scenario today. We're using 0.6.1.201212231917, but I've reproduced the problem on 0.6.4.201312101107 as well.
Read more >
java - How to get class of generic type when there is no ...
Since Java (or at least my Java 6) does not have the generic info any more during runtime, I currently can't think of...
Read more >
User's Guide Version 2023
If no .rsi file exists for a model, Reactis will create a default file the first time you open the Info File Editor,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found