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.56k stars 279 forks source link

Cobertura report generation emits NaN as complexity for async functions #623

Closed david-schneider-tfs closed 10 months ago

david-schneider-tfs commented 11 months ago

Describe the bug This might be an extension of #606. When using -reporttypes:Cobertura the resulting output file will have 'complexity="NaN"' for async functions. This appears to be a regression as it is not an issue in 4.x versions.

Looking in the report builder it looks like there is a disagreement over the method name for async functions. For example, with the attached sample file the codeElement parsed from the file has a method with the FullName of MoveNext() while the Name is AddAsync().

To Reproduce I've attached a sample file that can be used as an input that will show the issue. sampleCoberturaReport.txt

When that file is used as an input report, the output report will have the following:

<method name="AddAsync" signature="()" line-rate="1" branch-rate="1" complexity="NaN">
              <lines>
                <line number="51" hits="11" branch="false" />
              </lines>
            </method>
<method name="AddOneAsyncTask" signature="()" line-rate="0" branch-rate="1" complexity="NaN">
              <lines>
                <line number="55" hits="0" branch="false" />
                <line number="56" hits="0" branch="false" />
              </lines>
danielpalme commented 11 months ago

I fixed this problem. Next release will contain the change!

danielpalme commented 10 months ago

Release 5.1.26 is now available.