Skip to content

C# 9 record types show as a miss #992

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

Closed
rubberduck203 opened this issue Nov 14, 2020 · 7 comments
Closed

C# 9 record types show as a miss #992

rubberduck203 opened this issue Nov 14, 2020 · 7 comments
Labels
Solved The issue is solved and can be closed tenet-coverage Issue related to possible incorrect coverage with repro Issue with repro

Comments

@rubberduck203
Copy link

As you can see on line 32, my tests are running the PathCount constructor (and are elsewhere calling both getters), but is being registered as a miss.

image

https://codecov.io/gh/rubberduck203/GitNStats/src/116f2b93ef887097a8c0aac8b2ef7978b2905bb1/src/gitnstats.core/Analysis.cs

Version Info

  • Target Framework: .net5.0
  • coverlet.collector: 1.3.0
  • coverlet.msbuild: 2.9.0

If I have some time tomorrow, I'll try to create an MVCE.

@tonerdo
Copy link
Collaborator

tonerdo commented Nov 15, 2020

Looks like we should be looking for patterns that suggest a record declaration and ignoring that automatically. Haven't had a chance to test Coverlet with .NET 5, but a small repro project will be appreciated

@tonerdo tonerdo added the enhancement General enhancement request label Nov 15, 2020
@rubberduck203
Copy link
Author

rubberduck203 commented Nov 16, 2020

This is as minimal as I could think to make it.

coverlet-records-repro.zip

The unit test creates an instance of the record and accesses its property.

This is the console output

$ dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=\"opencover,lcov\"
  Determining projects to restore...
  Restored /Users/rubberduck/src/coverlet-records-repro/src/repro.csproj (in 77 ms).
  Restored /Users/rubberduck/src/coverlet-records-repro/tests/tests.csproj (in 352 ms).
  repro -> /Users/rubberduck/src/coverlet-records-repro/src/bin/Debug/net5.0/repro.dll
  tests -> /Users/rubberduck/src/coverlet-records-repro/tests/bin/Debug/net5.0/tests.dll
Test run for /Users/rubberduck/src/coverlet-records-repro/tests/bin/Debug/net5.0/tests.dll (.NETCoreApp,Version=v5.0)
Microsoft (R) Test Execution Command Line Tool Version 16.8.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.

Passed!  - Failed:     0, Passed:     1, Skipped:     0, Total:     1, Duration: 3 ms - /Users/rubberduck/src/coverlet-records-repro/tests/bin/Debug/net5.0/tests.dll (net5.0)

Calculating coverage result...
  Generating report '/Users/rubberduck/src/coverlet-records-repro/tests/coverage.opencover.xml'
  Generating report '/Users/rubberduck/src/coverlet-records-repro/tests/coverage.info'

+--------+------+--------+--------+
| Module | Line | Branch | Method |
+--------+------+--------+--------+
| repro  | 0%   | 100%   | 0%     |
+--------+------+--------+--------+

+---------+------+--------+--------+
|         | Line | Branch | Method |
+---------+------+--------+--------+
| Total   | 0%   | 100%   | 0%     |
+---------+------+--------+--------+
| Average | 0%   | 100%   | 0%     |
+---------+------+--------+--------+

@MarcoRossignoli MarcoRossignoli added tenet-coverage Issue related to possible incorrect coverage untriaged To be investigated with repro Issue with repro bug Something isn't working and removed enhancement General enhancement request labels Nov 16, 2020
@MarcoRossignoli MarcoRossignoli pinned this issue Dec 20, 2020
@MarcoRossignoli MarcoRossignoli unpinned this issue Dec 27, 2020
@MarcoRossignoli
Copy link
Collaborator

@rubberduck203 seem that the bug is solved in master(next 3.0.0 version), I did some test with our updated nightly

image

Can you try by yourself with nightly and confirm?

https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/ConsumeNightlyBuild.md#consume-nightly-build version 3.0.0-preview.18.g183cbed8a6

@MarcoRossignoli MarcoRossignoli added Solved The issue is solved and can be closed and removed bug Something isn't working untriaged To be investigated labels Dec 27, 2020
@rubberduck203
Copy link
Author

@MarcoRossignoli I think I’ll have some time tomorrow to test it out. I’ll get back to you.

@rubberduck203
Copy link
Author

Works like a charm @MarcoRossignoli. Thanks.

@MarcoRossignoli
Copy link
Collaborator

Great feel free to close this if solved!

@rubberduck203
Copy link
Author

Done!
I wasn't sure if you wanted to leave it open until it was released or not.
Thanks for the great tools!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Solved The issue is solved and can be closed tenet-coverage Issue related to possible incorrect coverage with repro Issue with repro
Projects
None yet
Development

No branches or pull requests

3 participants