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 (CommunityToolkit/dotnet) #1345

Closed
will-jj opened this issue May 28, 2022 · 3 comments
Closed

Comments

@will-jj
Copy link

will-jj commented May 28, 2022

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

I have a simple repro repo here: https://github.com/will-jj/MVVM-Coverage
Additionally the following log information may provide further insight into the cause of the issue:

[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]

The original issue was opened here: CommunityToolkit/dotnet#264

@petli
Copy link
Collaborator

petli commented May 30, 2022

Hi, this is a known issue, where Coverlet needs a hint from the code generator that the source code is generated. That hint is that the file ends in .g.cs, rather than plain .cs. If MVVM Toolkit can change that in the filenames being generated Coverlet will handle it correctly.

#1164 explains more what's causing this.

@will-jj
Copy link
Author

will-jj commented May 30, 2022

Thank you for the information, & apologies for overlooking the information that was available prior to opening this issue.

The change to .g.cs has been proposed in the following PR : CommunityToolkit/dotnet#284

@petli
Copy link
Collaborator

petli commented May 31, 2022

No problems, glad it could be solved quickly for you!

@petli petli closed this as completed May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants