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] Coverlet is not counting the model properties #930

Closed
ming-tsai opened this issue Aug 24, 2020 · 27 comments
Closed

[Bug] Coverlet is not counting the model properties #930

ming-tsai opened this issue Aug 24, 2020 · 27 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

@ming-tsai
Copy link

Hi there,
I'm using coverlet.msbuild to generate the coverlet and publish to SonarScanner, recently I upgrade v2.7.0 to v2.9.0, but on v2.9.0 is not counting the model properties.

Evidence

v2.9.0
image
v2.7.0
image

@ming-tsai ming-tsai changed the title Coverlet is not counting the model properties [Bug] Coverlet is not counting the model properties Aug 24, 2020
@petli
Copy link
Collaborator

petli commented Aug 25, 2020

This has been fixed in master (#328 #912) and will be included in the next release.

@petli petli closed this as completed Aug 25, 2020
@ming-tsai
Copy link
Author

ming-tsai commented Aug 25, 2020

Hi @petli, thanks, so, when is the next release day?

@petli
Copy link
Collaborator

petli commented Aug 25, 2020

Do you have any date planned already, @MarcoRossignoli ?

@MarcoRossignoli
Copy link
Collaborator

No atm...we need to talk about versions alignment cc: @tonerdo #874 and maybe if we've room we could fix this #900
We should also merge this new feat #904

@MarcoRossignoli
Copy link
Collaborator

MarcoRossignoli commented Aug 25, 2020

BTW not sure that the issue here is related to that new feature...the new feat will exclude autoprops.

@ming-tsai can you attach your command line?

@MarcoRossignoli MarcoRossignoli added tenet-coverage Issue related to possible incorrect coverage waiting for customer Waiting for customer action labels Aug 25, 2020
@ming-tsai
Copy link
Author

Hi @MarcoRossignoli,
This the command that I use to generate the coverage.

dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --logger trx

The issue has nothing to do with auto-props

@MarcoRossignoli
Copy link
Collaborator

Can you try with 2.8.1?

@ming-tsai
Copy link
Author

Same than 2.9.0 and I get these warnings

warning : [coverlet] Unable to instrument module: source\repos\Project\Project.Test\bin\Debug\netcoreapp3.0\System.ComponentModel.Annotations.dll because : No symbol found for file: source\repos\Project\Project.Test\bin\Debug\netcoreapp3.0\System.ComponentModel.Annotations.dll [source\repos\Project\Project.Test\Project.Test.csproj]
warning : [coverlet] Unable to instrument module: source\repos\Project\Project.Test\bin\Debug\netcoreapp3.0\System.Text.Encodings.Web.dll because : No symbol found for file: source\repos\Project\Project.Test\bin\Debug\netcoreapp3.0\System.Text.Encodings.Web.dll [source\repos\Project\Project.Test\Project.Test.csproj]

@MarcoRossignoli
Copy link
Collaborator

Warnings are ok, but for your problem we need a repro because is not expected, we got similar issue on 2.9.0 because we fixed a bug on ExcludeByAttribute feature #794 (comment) but your command line seems ok.

@MarcoRossignoli MarcoRossignoli added the needs repro Needs repro to be investigated, cannot repro in local label Aug 26, 2020
@ming-tsai
Copy link
Author

ming-tsai commented Aug 26, 2020

Hi @MarcoRossignoli,
I will try to create an example repo and attached to here.

@ming-tsai
Copy link
Author

Hi @MarcoRossignoli,
Let me attach the example repo.
v2.7.0
image
v2.9.0
image

Project
Example.zip

@ming-tsai
Copy link
Author

Hi @MarcoRossignoli,
Any updates?

@MarcoRossignoli
Copy link
Collaborator

Sorry @ming-tsai I'm bit busy these days...I'll think to work on it in the weekend 🙇

@ming-tsai
Copy link
Author

Hiya 👋,
Any update?

@MarcoRossignoli
Copy link
Collaborator

@ming-tsai Sorry for the delay, busy times I'll take a look asap

@ming-tsai
Copy link
Author

Ok @MarcoRossignoli, let me know when has any update

@MarcoRossignoli
Copy link
Collaborator

Thanks for the patience and sorry!

@ming-tsai
Copy link
Author

Thanks for the patience and sorry!

Don't worry 🧐, I will use v2.7.0 until fix this issue

@MarcoRossignoli MarcoRossignoli added untriaged To be investigated and removed needs repro Needs repro to be investigated, cannot repro in local waiting for customer Waiting for customer action labels Sep 18, 2020
@MarcoRossignoli
Copy link
Collaborator

@ming-tsai I cannot repro with your sample
image
Can you verify that my setup/command line is like your?

@MarcoRossignoli MarcoRossignoli added waiting for customer Waiting for customer action and removed untriaged To be investigated labels Nov 10, 2020
@ming-tsai
Copy link
Author

ming-tsai commented Nov 11, 2020

Hi @MarcoRossignoli, I'm going to test in my computer

@ming-tsai
Copy link
Author

Hi @MarcoRossignoli, sorry for the late response, my output is the same as yours but I'm sure that it is not counting the model properties.
The v2.7.0 coverage is 100% but on the v2.9.0 is 84%.
Why the previous version is counting and the new version is not? and what should I do with this type of unit test?

@MarcoRossignoli
Copy link
Collaborator

I'll take another deep look to understand the counting difference, I'm pretty sure that the culprit is some accounting fix

@ming-tsai
Copy link
Author

Hi @MarcoRossignoli, please update the labels

@MarcoRossignoli MarcoRossignoli added with repro Issue with repro untriaged To be investigated and removed waiting for customer Waiting for customer action labels Dec 17, 2020
@MarcoRossignoli MarcoRossignoli pinned this issue Dec 18, 2020
@MarcoRossignoli
Copy link
Collaborator

MarcoRossignoli commented Dec 27, 2020

@ming-tsai I did some test with nightly and 100% comes back, so as @petli said should be fixed on master.

 C:\git\playground\coverlet\Example                                                                                                                                                                                                                                [15:21]
❯ dotnet test /p:CollectCoverage=true
  Determining projects to restore...
C:\Program Files\dotnet\sdk\5.0.200-preview.20601.7\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp3.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\git\playground\coverlet\Example\Example.Test\Example.Test.csproj]
  All projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\5.0.200-preview.20601.7\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp3.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\git\playground\coverlet\Example\Example.Test\Example.Test.csproj]
  You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
  You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
  Example.Core -> C:\git\playground\coverlet\Example\Example.Core\bin\Debug\netstandard2.0\Example.Core.dll
  Example.Test -> C:\git\playground\coverlet\Example\Example.Test\bin\Debug\netcoreapp3.0\Example.Test.dll
C:\Users\mrossignoli\.nuget\packages\coverlet.msbuild\3.0.0-preview.18.g183cbed8a6\build\coverlet.msbuild.targets(39,5): warning : [coverlet] Unable to instrument module: C:\git\playground\coverlet\Example\Example.Test\bin\Debug\netcoreapp3.0\System.ComponentModel.Annotations.dll because : No symbol found for file: C:\git\playground\coverlet\Example\Example.Test\bin\Debug\netcoreapp3.0\System.ComponentModel.Annotations.dll [C:\git\playground\coverlet\Example\Example.Test\Example.Test.csproj]
Test run for C:\git\playground\coverlet\Example\Example.Test\bin\Debug\netcoreapp3.0\Example.Test.dll (.NETCoreApp,Version=v3.0)
Microsoft (R) Test Execution Command Line Tool Version 16.9.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: 114 ms - Example.Test.dll (netcoreapp3.0)

Calculating coverage result...
  Generating report 'C:\git\playground\coverlet\Example\Example.Test\coverage.json'

+--------------+------+--------+--------+
| Module       | Line | Branch | Method |
+--------------+------+--------+--------+
| Example.Core | 100% | 100%   | 100%   |
+--------------+------+--------+--------+

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

Can you try with nightly and confirm? https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/ConsumeNightlyBuild.md version

<PackageReference Include="coverlet.msbuild" Version="3.0.0-preview.18.g183cbed8a6">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>

@MarcoRossignoli MarcoRossignoli added Solved The issue is solved and can be closed and removed untriaged To be investigated labels Dec 27, 2020
@MarcoRossignoli MarcoRossignoli unpinned this issue Dec 27, 2020
@ming-tsai
Copy link
Author

Hi @MarcoRossignoli,
So should I wait for 3.0.0?

@MarcoRossignoli
Copy link
Collaborator

Yep, btw a double check could help to be sure of it and close this, release is very close.

@ming-tsai
Copy link
Author

Thanks guys, it is work

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