ReportGenerator
ReportGenerator copied to clipboard
wrong handling of internal record structs
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;
}
- getting coverage with dotcover
- converting with reportgenerator
leads to multiple
<method name="Name" signature="()" line-rate="1" branch-rate="1" complexity="NaN">
<lines>
<line number="7" hits="1" branch="false" />
</lines>
</method>
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
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
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.
I filed a PR, would be great if you could have a look at it.
Yes. I will have a look as soon as possible. But it will take some time!
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
- I won't merge your PR, because it will change the default handling of nested classes
Good news
- In #630 I added a "raw mode" for Cobertura files. I now did the same for dotCover (see 4444f14f0b574d4deda7921e3ab6892c823474c7)
- You need a PRO license to use the new feature.
I can give you a license for your efforts, just send me a short message (https://reportgenerator.io/contact)
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:
- Raw mode is currently only supported for Cobertura and dotCover files.
- If you want HTML report and Cobertura output, you should execute ReportGenerator twice:
- Cobertura:
settings:rawMode=true - HTML:
settings:rawMode=false
- Cobertura:
Documentation of the new feature: https://reportgenerator.io/features#rawmode https://reportgenerator.io/pro https://github.com/danielpalme/ReportGenerator/wiki/Settings#other-settings