-
Notifications
You must be signed in to change notification settings - Fork 382
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.collector not adding a .NET MAUI project to the coverage.cobertura.xml #1423
Comments
This is being caused by xaml files being included within the project. For some reason it is blocking coverage from completing. Removing those files allows coverage to complete as expected. A work around is to either convert any xaml into code or move all xaml files into their own project and reference them from there. |
The reason is that
The current released versions of There is a upcoming breaking change of this mapping algorithem in The drawback now is that the source generator files are also listed in the report. To clean up the generated report you can just add an exclusion filter As this change in |
I'm closing this as it seems to be resolved in the upcoming version. Feel free to reopen. |
We found out that we need to add coverlet.msbuild as a package reference to the MAUI test project to have the coverage report being generated. Previously with the Xamarin.Forms app, coverlet.collector was sufficient. |
I have a .NET MAUI project and a (Unit) Tests project in the same solution. The Tests project references the .NET MAUI project and the tests run fine. I want to also add code coverage for the .NET MAUI project. However, I am unable to get this to work with coverlet.collector as the produced coverage.cobertura.xml does not include the .NET MAUI project (as one of the packages).
Why is it not picking up the .NET MAUI project?
Below is my proj file for the Tests project:
Below is my proj file for the .NET MAUI project:
I run the following command under the Tests project root:
dotnet test --collect:"XPlat Code Coverage"
...and eventually get the following output:
All the tests pass, including the ones covering the MauiApp.Client.
Below are the contents of the coverage.cobertura.xml file:
As you can see, the coverage.cobertura.xml file is missing the MauiApp.Client project (package). However, it picks-up the Service project, which is just a plain .NET 6 project (non-MAUI).
I am seeing the same behavior locally on my Windows 10 machine as well as in the ADO pipeline.
The text was updated successfully, but these errors were encountered: