Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] System.IndexOutOfRangeException using coverlet collector #1682

Closed
peibol71 opened this issue Aug 6, 2024 · 5 comments
Closed

[BUG] System.IndexOutOfRangeException using coverlet collector #1682

peibol71 opened this issue Aug 6, 2024 · 5 comments
Labels
needs more info More details are needed question This issue is a question

Comments

@peibol71
Copy link

peibol71 commented Aug 6, 2024

I can't get the coverage.coverture.xml file because of this exception error

I'm using this command:
dotnet test -c Release --collect:"XPlat Code Coverage"

And get this error message:
Data collector 'XPlat code coverage' message: Coverlet.Collector.Utilities.CoverletDataCollectorException: CoverletCoverageDataCollector: Failed to get coverage report
---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Coverlet.Core.Reporters.CoberturaReporter.Report(CoverageResult result)
at Coverlet.Collector.DataCollection.CoverageManager.GetCoverageReport(CoverageResult coverageResult)
--- End of inner exception stack trace ---
at Coverlet.Collector.DataCollection.CoverageManager.GetCoverageReport(CoverageResult coverageResult)
at Coverlet.Collector.DataCollection.CoverageManager.GetCoverageReport()
at Coverlet.Collector.DataCollection.CoverletCoverageCollector.OnSessionEnd(Object sender, SessionEndEventArgs e).

.NET configuration:
* coverlet.collector v6.0.2
* .NET 6.0
* Windows 11 Pro x64
* Also reproducible on azure devops pipeline

Any idea?

Thanks.

@github-actions github-actions bot added the untriaged To be investigated label Aug 6, 2024
@Bertk Bertk added question This issue is a question needs more info More details are needed and removed untriaged To be investigated labels Aug 7, 2024
@Bertk
Copy link
Collaborator

Bertk commented Aug 7, 2024

Please check whether PDB files are available in the output folder.

Locates the unit test assembly and selects all the referenced assemblies that have PDBs.

https://github.com/coverlet-coverage/coverlet?tab=readme-ov-file#how-it-works

@peibol71
Copy link
Author

peibol71 commented Aug 7, 2024

There is one PDB file (projectname.pdb) in projectfolder\obj\Release\net6.0 and the same and 4 others in projectfolder\bin\Release\net6.0

@Bertk
Copy link
Collaborator

Bertk commented Aug 7, 2024

Maybe diagnostic logs will provide more information.

dotnet test --collect:"XPlat Code Coverage" --settings runsettings --diag:log.txt

@peibol71
Copy link
Author

peibol71 commented Aug 7, 2024

Sorry, that's not a bug.
There was a misconfigured Directory.Build.props file and the project was using coverlet.collector v1.0 instead of v6.0.2

@Bertk
Copy link
Collaborator

Bertk commented Aug 7, 2024

No problem. Please close the issue.

@peibol71 peibol71 closed this as completed Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info More details are needed question This issue is a question
Projects
None yet
Development

No branches or pull requests

2 participants