danielpalme / ReportGenerator

ReportGenerator converts coverage reports generated by coverlet, OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov or lcov into human readable reports in various formats.
https://reportgenerator.io
Apache License 2.0
2.62k stars 283 forks source link

wrong handling of internal record structs #685

Closed theKBro closed 1 month ago

theKBro commented 2 months ago

internal record structs are handled incorrectly

namespace ClassLibrary1;

public class DummyMix
{
    private readonly record struct DummyInternalRecord(string Type, string Name, string Attribute);

    private readonly DummyInternalRecord _internalRecord;

    public DummyMix(string name)
    {
        _internalRecord = new DummyInternalRecord("string", name, "");
    }

    public string Name => _internalRecord.Name;

}

with missing DummyInternalRecord context

for the full dummy project see ClassLibrary1.zip

if I can help to inspect this further please don't hesitate to contact me. thanks in advance

theKBro commented 2 months ago

this leads to jenkins recordCoverage errors e.g. Found unhandled java.lang.IllegalArgumentException exception: There is already the same child [METHOD] Name() <0> with the name Name() in [CLASS]

possibly related with #630

danielpalme commented 2 months ago

Will have a look within the next 3-4 weeks. Probably I won't be able to do anything about this problem, but we will see.

theKBro commented 2 months ago

I filed a PR, would be great if you could have a look at it.

danielpalme commented 2 months ago

Yes. I will have a look as soon as possible. But it will take some time!

danielpalme commented 2 months ago

This is related to #630 (Cobertura format instead of dotCover).

Some history: When I started to implement ReportGenerator only HTML format was available. I decided to display nested classes and structs within the parent class.

This was a reasonable approach, since HTML is for human users.

Later Cobertura was added as an output format. Here is makes more sense to treat nested types separately.

Bad news

Good news

The new feature will be available in version 5.3.9 (I will release as soon as all open issues are resolved)

The setting (settings:rawMode=true) disables that coverage data of nested or compiler generated classes is included in the parent class.

Limitations:

Documentation of the new feature: https://reportgenerator.io/features#rawmode https://reportgenerator.io/pro https://github.com/danielpalme/ReportGenerator/wiki/Settings#other-settings