Skip to content

Coverlet Cannot Cover Module Using MVVM Toolkit #264

Closed

Description

@will-jj

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

Activity

  1. added
    bug 🐛An unexpected issue that highlights incorrect behavior
    on May 23, 2022
  2. Sergio0694 commented on May 27, 2022

    @Sergio0694
    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! 🙂

  3. will-jj commented on May 30, 2022

    @will-jj
    Author

    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

  4. added
    external ⤴️Something related to or caused by an external project
    next preview ✈️This changes will be available in the upcoming preview
    and removed on May 30, 2022
  5. Sergio0694 commented on May 30, 2022

    @Sergio0694
    Member

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

  6. will-jj commented on May 30, 2022

    @will-jj
    Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛An unexpected issue that highlights incorrect behaviorexternal ⤴️Something related to or caused by an external projectmvvm-toolkit 🧰Issues/PRs for the MVVM Toolkitnext preview ✈️This changes will be available in the upcoming preview

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions