Reportgenerator: Limit report files path lengths

Created on 5 Oct 2018  路  8Comments  路  Source: danielpalme/ReportGenerator

Currently we run in an issue when using the VSTS Publish code coverage results task to publish the HTMLInline report. The HTML files generated have paths longer than 259 chars and this causes the task to fail.
I know this is not a situation caused by ReportGenerator, but is there a way to reduce file path lengths? Like for example use short hashes instead of full assembly/class/method names and nestings?
See also https://github.com/Microsoft/vsts-tasks/issues/8368

enhancement

All 8 comments

I limited the length of the file names to ~100 characters.
If length exceeds 100 characters, the middle part is removed form the file name.

Next (pre-)release will contain the fix. I will publish the new package within the next days.

Great work @danielpalme! Thanks

Hi @danielpalme I now get this

Loading report 'D:\weg\coverage\cobertura-results.xml' 1/1
 Preprocessing report
 Initiating parser for Cobertura
  Current Assembly: Jobbird.Domain.Core
  Current Assembly: Jobbird.Functions
  Current Assembly: Jobbird.Infrastructure
 Error during reading report 'D:\weg\coverage\cobertura-results.xml' (Size: 1.6MB): Multiple errors
An item with the same key has already been added. Key: 9
An item with the same key has already been added. Key: 11
An item with the same key has already been added. Key: 9
An item with the same key has already been added. Key: 9

Coverage report parsing took 0.3 seconds
Initializing report builders for report types: HTMLInline, HTMLChart
Analyzing 0 classes
 Creating summary
Report generation took 1.0 seconds

I have incuded the source cobertura-results.xml file: cobertura-results.zip

FYI: we run multiple .Net unit tests with Coverlet, and have the results merged into one Cobertura output file. This may cause the duplicate keys?

That another issue and you are right, the duplicate keys are caused by merging several files.

Could you please try this new release and let me know if it works for you:
https://www.nuget.org/packages/ReportGenerator/4.0.0-rc8
https://www.nuget.org/packages/dotnet-reportgenerator-cli/4.0.0-rc8
https://www.nuget.org/packages/dotnet-reportgenerator-globaltool/4.0.0-rc8

@danielpalme I tried rc8 release right away, but still same issue with duplicate keys. Did you target that problem in rc8? Or is there no support (yet) for merged results?

I have tested with your XML file. Did you use a different file?

@danielpalme Locally I still had the issue, maybe rc7 is still deployed somehow. But in VSTS hosted (clean) ageant it all works just fine now! Many thanks for your work!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nilfdev picture nilfdev  路  5Comments

dotnetjunkie picture dotnetjunkie  路  3Comments

Thilas picture Thilas  路  4Comments

eduherminio picture eduherminio  路  5Comments

jpedretti-ciandt picture jpedretti-ciandt  路  3Comments