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

Coverlet Cannot Cover Module Using MVVM Toolkit #264

Closed
1 of 4 tasks
will-jj opened this issue May 23, 2022 · 4 comments · Fixed by #284
Closed
1 of 4 tasks

Coverlet Cannot Cover Module Using MVVM Toolkit #264

will-jj opened this issue May 23, 2022 · 4 comments · Fixed by #284
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior external ⤴️ Something related to or caused by an external project mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit next preview ✈️ This changes will be available in the upcoming preview
Projects

Comments

@will-jj
Copy link

will-jj commented May 23, 2022

Describe the bug

With a module containing code generated by the MVVM Toolkit coverage information from Coverlet will not be created.

Regression

No response

Steps to reproduce

1. Create a project using the MVVM toolkit
2. Add a class which uses features from the toolkit & generates code
3. Run  dotnet test /p:CollectCoverage=true
4. Observe that modules without MVVM toolkit have coverage & those with do not

Expected behavior

Expect to observe coverage information of all modules with tests.

Screenshots

No response

IDE and version

VS 2022

IDE version

17.1.3

Nuget packages

  • CommunityToolkit.Common
  • CommunityToolkit.Diagnostics
  • CommunityToolkit.HighPerformance
  • CommunityToolkit.Mvvm (aka MVVM Toolkit)

Nuget package version(s)

8.0.0-preview3

Additional context

Example repo with action running test here:
https://github.com/will-jj/MVVM-Coverage

Coverlet log information here:

[coverlet] Unable to instrument module: C:\x\CoverageIssue\CoverageIssue.Tests\bin\Debug\net6.0-windows\CoverageIssue.dll, pdb without local source files, [C:\x\CoverageIssue\CoverageIssue\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\CoverageIssue.ViewModelUsesObservableProperty.cs]

Help us help you

No, just wanted to report this

@will-jj will-jj added the bug 🐛 An unexpected issue that highlights incorrect behavior label May 23, 2022
@Sergio0694 Sergio0694 added the mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit label May 27, 2022
@Sergio0694
Copy link
Member

Hey @will-jj, did you open an issue about this in the Coverlet repo? If so we should reference it here too.
Also if they confirm this is just an issue with that library we can close this. Thanks! 🙂

@will-jj
Copy link
Author

will-jj commented May 30, 2022

Hi @Sergio0694, they have got back to me and without too much repetition: it is a known issue coverlet-coverage/coverlet#1164

The proposed solution would be to suffix the generated files with .g.cs rather than .cs

@Sergio0694 Sergio0694 added external ⤴️ Something related to or caused by an external project next preview ✈️ This changes will be available in the upcoming preview and removed needs author feedback 📝 This issue or PR needs a reply from the author labels May 30, 2022
@Sergio0694 Sergio0694 added this to To do in 8.0 via automation May 30, 2022
@Sergio0694
Copy link
Member

Thank you for linking that issue. I do believe this is technically external, but no harm in using ".g.cs" ourselves too 🙂

@Sergio0694 Sergio0694 moved this from To do to In progress in 8.0 May 30, 2022
@will-jj
Copy link
Author

will-jj commented May 30, 2022

Thanks very much for making the change, I've updated my repo with the build from the PR & it is now providing coverage results.

8.0 automation moved this from In progress to Done Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior external ⤴️ Something related to or caused by an external project mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit next preview ✈️ This changes will be available in the upcoming preview
Projects
No open projects
8.0
Done
Development

Successfully merging a pull request may close this issue.

2 participants