# C# Coverage always 0%

**URL:** <https://community.codecov.com/t/c-coverage-always-0/1408>\
**Category:** Support\
**Created:** [May 12, 2020, 9:36pm UTC](https://community.codecov.com/t/c-coverage-always-0/1408 "2020-05-12T21:36:02Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fosol](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/fosol/32/761_2.png) [@Fosol](https://community.codecov.com/u/Fosol)\
**Post date:** [May 12, 2020, 9:36pm UTC](https://community.codecov.com/t/c-coverage-always-0/1408/1 "2020-05-12T21:36:02Z")

</div>

### Description

I have a mono-repo with a c# backend. I use Coverlet to generate a report. I’ve tried the following formats; json, lcov, opencover, cobertura. All result in 0% coverage when sent to Codecov. It does however show the graph of all files.

### Repository

> **[GitHub - Fosol/PIMS: Property Inventory Management System](https://github.com/Fosol/PIMS)**
>
> Property Inventory Management System

### Commit SHAs

a53cebf39b43d60368042d8a2a99936661925bd9

### Codecov YAML

```yaml
codecov:

  require_ci_to_pass: yes

  branch: dev

coverage:

  precision: 2

  round: down

  range: "70...100"

parsers:

  gcov:

    branch_detection:

      conditional: yes

      loop: yes

      method: no

      macro: no

comment:

  layout: "reach,diff,flags,tree"

  behavior: default

  require_changes: no

```

### Additional Information

He is the GitHub action I use to generate and send the report to Codecov.

```yaml
name: API (.NET Core)

on:
  push:
    branches: [master, dev]
  pull_request:
    branches: [master, dev]

jobs:
  build:
    runs-on: ubuntu-latest
    env:
      working-directory: ./backend
      codeCov-token: ${{ secrets.CodeCov }}

    steps:
      - uses: actions/checkout@v2
      - name: Setup .NET Core
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: 3.1.101
      - name: Install dependencies
        run: dotnet restore
        working-directory: ${{env.working-directory}}
      - name: Install coverlet for code coverage
        run: dotnet tool install -g coverlet.console
        working-directory: ${{env.working-directory}}
      - name: Build
        run: dotnet build --configuration Release --no-restore
        working-directory: ${{env.working-directory}}
      - name: Test
        run: dotnet test --no-restore --verbosity normal
        working-directory: ${{env.working-directory}}
      - name: Generate code coverage
        run: coverlet ./tests/unit/api/bin/Release/netcoreapp3.1/Pims.Api.Test.dll --target "dotnet" --targetargs "test ./ --no-build" -o "./tests/TestResults/api-coverage.json" --exclude "[*.Test]*" --exclude "[*]*Model" --exclude-by-attribute "CompilerGenerated" -f json
        working-directory: ${{env.working-directory}}
      - name: Merge code coverage
        run: coverlet ./tests/unit/dal/bin/Release/netcoreapp3.1/Pims.Dal.Test.dll --target "dotnet" --targetargs "test ./ --no-build" -o "./tests/TestResults/" --exclude "[*.Test]*" --exclude "[*]*Model" --exclude-by-attribute "CompilerGenerated" --merge-with "./tests/TestResults/api-coverage.json" -f lcov
        working-directory: ${{env.working-directory}}

      - name: Codecov
        uses: codecov/codecov-action@v1.0.7
        with:
          # User defined upload name. Visible in Codecov UI
          name: PIMS
          # Repository upload token - get it from codecov.io. Required only for private repositories
          token: ${{env.codeCov-token}}
          # Path to coverage file to upload
          file: ${{env.working-directory}}/tests/TestResults/coverage.info
          # Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)
          flags: unittests
          # Environment variables to tag the upload with (e.g. PYTHON | OS,PYTHON)
          env_vars: C#
          # Specify whether or not CI build should fail if Codecov runs into an error during upload
          fail_ci_if_error: true

```

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [May 15, 2020, 4:06pm UTC](https://community.codecov.com/t/c-coverage-always-0/1408/2 "2020-05-15T16:06:18Z")

</div>

Hi @Fosol, I’m not too sure what’s happening here. I currently see coverage for files on your repository page [Codecov](https://codecov.io/gh/Fosol/PIMS).

I can see coverage for that particular commit being processed, but I don’t actually see the commit. Did you rebase or merge over it?

---

<div class="post-metadata">

**Author:** ![Fosol](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/fosol/32/761_2.png) [@Fosol](https://community.codecov.com/u/Fosol)\
**Post date:** [May 15, 2020, 4:23pm UTC](https://community.codecov.com/t/c-coverage-always-0/1408/3 "2020-05-15T16:23:01Z")

</div>

I ended up rebasing and attempting a number of other attempts to resolve. In the end it would appear we needed to use a different tool to generate the reports.

We were using Coverlet to generate our files. Locally we could see they had the relevant information, but uploading them to Codecov just didn’t work.

We are now going to try using the built in report generation with `dotnet`.

`dotnet test --collect:"XPlat Code Coverage" --settings coverlet.runsettings --no-restore`

With some configuration we believe this will work. Find out soon, as we’ll be merging into our repo and testing.

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [May 15, 2020, 4:36pm UTC](https://community.codecov.com/t/c-coverage-always-0/1408/4 "2020-05-15T16:36:01Z")

</div>

Sounds good, if you happen to have a copy of a coverlet report, I’d love to get that to my team to see if it’s supportable in the future.

---

<div class="post-metadata">

**Author:** ![clicketyclackety](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/clicketyclackety/32/2017_2.png) [@clicketyclackety](https://community.codecov.com/u/clicketyclackety)\
**Post date:** [December 10, 2021, 11:30pm UTC](https://community.codecov.com/t/c-coverage-always-0/1408/5 "2021-12-10T23:30:21Z")

</div>

Were you ever given this Tom, I’m trying to use Coverlet too but finding the same 0% coverage, I think I’ll try the built in donet report if thats what works

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [December 11, 2021, 12:03am UTC](https://community.codecov.com/t/c-coverage-always-0/1408/6 "2021-12-11T00:03:22Z")

</div>

@clicketyclackety I don’t believe I was. If you have a setup, I can take a look to see if there’s just a problem with us parsing that kind of report. Do you have a commit SHA?

---

<div class="post-metadata">

**Author:** ![clicketyclackety](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/clicketyclackety/32/2017_2.png) [@clicketyclackety](https://community.codecov.com/u/clicketyclackety)\
**Post date:** [December 11, 2021, 12:15am UTC](https://community.codecov.com/t/c-coverage-always-0/1408/7 "2021-12-11T00:15:49Z")

</div>

Latest SHA: 71c884dd5a08a37e7aca2605c79f7999607efe1d  
Every single commit reads like this;  
 ![image](https://canada1.discourse-cdn.com/flex029/uploads/codecov/original/2X/e/e077d64bfe8ac3cc2c1222c58d666111a70d1bd1.png)

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [December 13, 2021, 9:31pm UTC](https://community.codecov.com/t/c-coverage-always-0/1408/8 "2021-12-13T21:31:16Z")

</div>

@clicketyclackety ahh, can you add the [GitHub app integration](https://github.com/apps/codecov) if you haven’t done so already?
