question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Zero coverage collection specifically during a CI build

See original GitHub issue

I’ve been updating my project, CSharpMinifier, to bring it up to date with the .NET 6 SDK as well as its dependencies. As part of that, I’ve been also fixing the code coverage collection by using the data collector instead of the MSBuild integration (which was misreporting coverage with NaN percentages).

Everything is working locally, as can be seen by the following text summary generated by ReportGenerator:

Summary
  Generated on: 13/11/2021 - 14:42:18
  Parser: MultiReportParser (15x CoberturaParser)
  Assemblies: 1
  Classes: 14
  Files: 11
  Line coverage: 96.9%
  Covered lines: 1065
  Uncovered lines: 33
  Coverable lines: 1098
  Total lines: 2209

CSharpMinifier                            96.9%
  CSharpMinifier.CSharpString             99.3%
  CSharpMinifier.Internals.JsonString     96.4%
  CSharpMinifier.MinificationOptions      96.0%
  CSharpMinifier.Minifier                 98.8%
  CSharpMinifier.Position                 82.3%
  CSharpMinifier.Region                   75.0%
  CSharpMinifier.Scanner                  99.7%
  CSharpMinifier.StringExtensions        100.0%
  CSharpMinifier.StringValueParseResult   59.3%
  CSharpMinifier.SubstringPool           100.0%
  CSharpMinifier.SyntaxErrorException     33.3%
  CSharpMinifier.Token                    33.3%
  CSharpMinifier.TokenExtensions         100.0%
  CSharpMinifier.TokenKindExtensions     100.0%

However, on CI builds (using AppVeyor), I am getting zero coverage:

Summary
  Generated on: 11/13/2021 - 1:39:02 PM
  Parser: MultiReportParser (6x CoberturaParser)
  Assemblies: 0
  Classes: 0
  Files: 0
  Line coverage: 
  Covered lines: 0
  Uncovered lines: 0
  Coverable lines: 0
  Total lines: 0
No assemblies have been covered.

I have Codecov setup to report on uploaded coverage data and it’s showing a blank. When I check the coverage XML files uploaded to Codecov, they are indeed empty.

I have also added diagnostics logging and uploaded the files as artifacts but cannot find anything unusual or an error in them.

I have scanned the issues in this repo and went over the troubleshooting page to try and solve the problem on my own, but now opening this issue having reached a roadblock. Hope it’s not some stupid mistake on my part. Let me know how I can help with more data and input to troubleshoot this issue.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
atifazizcommented, Nov 15, 2021

So disabling incremental cleaning did the trick for me! Coverage is not being reported during a CI build too! 🎉

@daveMueller Thanks again for sharing your findings, which provided some clues and eventually helped me to find the real culprit and solution!

0reactions
atifazizcommented, Nov 15, 2021

Hey @daveMueller, just thought I’d share some some of my findings so far in case it can help in the future even though it’s not related to coverlet. It seems that incremental cleaning is the culprit here. I found the following in the build logs for second runs:

IncrementalClean:
    Deleting file "A:\CSharpMinifier\src\CSharpMinifier\obj\Debug\netstandard2.0\NuGet\2FAA44F34CC261533864249AA4CA67060BF904CA\Nullable\1.3.0\Nullable\AllowNullAttribute.cs".
    Deleting file "A:\CSharpMinifier\src\CSharpMinifier\obj\Debug\netstandard2.0\NuGet\2FAA44F34CC261533864249AA4CA67060BF904CA\Nullable\1.3.0\Nullable\DisallowNullAttribute.cs".
    Deleting file "A:\CSharpMinifier\src\CSharpMinifier\obj\Debug\netstandard2.0\NuGet\2FAA44F34CC261533864249AA4CA67060BF904CA\Nullable\1.3.0\Nullable\DoesNotReturnAttribute.cs".
    Deleting file "A:\CSharpMinifier\src\CSharpMinifier\obj\Debug\netstandard2.0\NuGet\2FAA44F34CC261533864249AA4CA67060BF904CA\Nullable\1.3.0\Nullable\DoesNotReturnIfAttribute.cs".
    Deleting file "A:\CSharpMinifier\src\CSharpMinifier\obj\Debug\netstandard2.0\NuGet\2FAA44F34CC261533864249AA4CA67060BF904CA\Nullable\1.3.0\Nullable\MaybeNullAttribute.cs".
    Deleting file "A:\CSharpMinifier\src\CSharpMinifier\obj\Debug\netstandard2.0\NuGet\2FAA44F34CC261533864249AA4CA67060BF904CA\Nullable\1.3.0\Nullable\MaybeNullWhenAttribute.cs".
    Deleting file "A:\CSharpMinifier\src\CSharpMinifier\obj\Debug\netstandard2.0\NuGet\2FAA44F34CC261533864249AA4CA67060BF904CA\Nullable\1.3.0\Nullable\MemberNotNullAttribute.cs".
    Deleting file "A:\CSharpMinifier\src\CSharpMinifier\obj\Debug\netstandard2.0\NuGet\2FAA44F34CC261533864249AA4CA67060BF904CA\Nullable\1.3.0\Nullable\MemberNotNullWhenAttribute.cs".
    Deleting file "A:\CSharpMinifier\src\CSharpMinifier\obj\Debug\netstandard2.0\NuGet\2FAA44F34CC261533864249AA4CA67060BF904CA\Nullable\1.3.0\Nullable\NotNullAttribute.cs".
    Deleting file "A:\CSharpMinifier\src\CSharpMinifier\obj\Debug\netstandard2.0\NuGet\2FAA44F34CC261533864249AA4CA67060BF904CA\Nullable\1.3.0\Nullable\NotNullIfNotNullAttribute.cs".
    Deleting file "A:\CSharpMinifier\src\CSharpMinifier\obj\Debug\netstandard2.0\NuGet\2FAA44F34CC261533864249AA4CA67060BF904CA\Nullable\1.3.0\Nullable\NotNullWhenAttribute.cs".

I think I might be running into dotnet/msbuild#1054 although I still haven’t found a solution based on what I’ve read in the issue’s thread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding test coverage to your continuous integration pipeline
Learn to put a simple codebase with test coverage into a CI pipeline, then configure CircleCI to send results to Coveralls.
Read more >
unit testing - Unexpected Code Coverage Reduction
I have set up my CI system to fail builds where the code coverage percentage is reduced compared to previous build - mainly...
Read more >
Continuous Integration (CI) Explained - Semaphore
What is Continuous Integration (CI)? A software development practice of merging code changes to a main branch many times per day. Learn how...
Read more >
Should code coverage be executed EVERY build? [closed]
The CI server will compile the code, test it, and generate code coverage stats on every check-in. Although there's nothing conceptually wrong ...
Read more >
CI/CD pipelines explained: Everything you need to know
Planning to implement CI/CD? This comprehensive guide explores the stages of a CI/CD pipeline, its pros and cons, best practices and more.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found