Release 4.8.6 does not produce accurate coverage reports for generic classes anymore
See original GitHub issueAs 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:
- Created 3 years ago
- Comments:9 (6 by maintainers)

Top Related StackOverflow Question
Sorry for that. I fixed it in release 4.8.7.
@rzikm I improved the filtering in release 5.1.4.