Search Issue Tracker

Won't Fix

Votes

16

Found in

2021.3.4f1

2023.2.0a1

Issue ID

UUM-15006

Regression

No

Coverage.GetStatsFor API shows 0 hits for generic methods

--

-

Steps to reproduce:
# Open attached project
# Enable Code Coverage by pressing Test/Toggle
# Open Test Runner and run all editor tests
# Click Test/Cov to print coverage results

Actual result: Notice that hitCount for lines 26, 27 and 28 is 0

Using Coverage.GetStatsForAllCoveredMethods instead of Coverage.GetStatsFor will return correct hitCount. Open TestGenerics.cs, comment line 15 and uncomment line 16. Redo repro steps. Notice that now hitCount on lines 26, 27 and 28 is 1.

Reproduced with: 2021.3.4f1

  1. Resolution Note:

Comments (6)

  1. JuliusJ

    Mar 27, 2023 13:11

    This issue is for the Code Coverage API and not the Code Coverage package.

    There was a regression in the Code Coverage package which caused a similar issue. It was fixed in version 1.2.3 of the package and can be tracked here:
    https://issuetracker.unity3d.com/issues/coverage-package-fails-to-gather-any-coverage-for-generic-methods

  2. SpectaluarTree

    Feb 28, 2023 01:33

    The issue seems to appear on package version "1.2.2", but not on "1.1.1".
    As a temporary solution we can use the older version

  3. yilin-li

    Feb 02, 2023 07:39

    Reproduced on version 2021.3.17f1

  4. brunobiluca

    Jan 16, 2023 18:14

    Reproduced on version 2021.3.16f1

  5. nic_mothandflame

    Jan 14, 2023 00:16

    Reproduced on version 2020.3.39f1

  6. willykc

    Oct 27, 2022 17:32

    Reproduced on version 2020.3.33

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.