Hide/Remove Projects/Classes/etc. from coverage
Installed product versions
- VS 2019 Community
- Extension 1.1.63
Description
Unable to hide or remove coverage reports for unnecessary projects
Steps to recreate
- Run tests
- See code coverage report
Current behavior
Summary Code coverage for unit test projects are shown with calculations over entire solution
Expected behavior
Should be a way to hide/remove projects as needed and have coverage calculated only on desired projects fpr summary reporting i.e. Right click project, select hide from coverage report
Additionally, it'd be good to have the ability to readd projects as desired, if one were to go project by project inside a solution
Side Notes
Awesome extension
Unable to hide or remove coverage reports for unnecessary projects
The Exclude project element or Fine Code Coverage option is there for this reason. You can apply an exclusion attribute in a project as well.
Right click project, select hide from coverage report
We could do that but I don't think that it would be silent.
Additionally, it'd be good to have the ability to readd projects as desired, if one were to go project by project inside a solution
Are you thinking of an option - filter report by selected project. Then dependent upon the selected project in solution explorer we filter to only show that filter ?
I understand fine code coverage is not ReSharper, but I am coming from a ReSharper background.

When you run code coverage with ReSharper, it also includes test projects in the code coverage, but you can exclude tests from the summary without needing an attribute of any kind. You can simply right click and click remove.
A filter of some kind would achieve what I am thinking of as well.
You can exclude test projects with IncludeTestAssembly as a global visual studio option or on a project basis.
Is there a way to get Fine Code Coverage to use the include/exclude settings I've already defined within my *.runsettings file instead of requiring them to be re-setup within Fine Code Coverage vs options?
I simply use the [ExcludeFromCodeCoverage] over a class or method. If anyone was wondering how to do in C#.
{
[ExcludeFromCodeCoverage] // <== this line
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
This appears to work at the class level, but not for methods. Methods marked with the ExcludeFromCodeCoverage attribute aren't excluded from the code coverage calculation.
@craigktreasure Is this only when using ms code coverage ?
Hmmm...good question. Not sure. I have RunMsCodeCoverage set to No in the FCC settings.
@craigktreasure ExcludeFromCodeCoverage should work on methods. Do you have a repo that I can look at ?
Not that I can quickly share. To be clear, what i'm seeing is that the Fine Code Coverage window doesn't properly reflect excluded methods. For that matter, it's the same for assemblies marked with ExcludeFromCodeCoverage.
The reports I generate using Coverlet are correct. It's just the Fine Code Coverage window that doesn't reflect properly.
FCC uses Coverlet version 3.0.3 and a fork of https://github.com/danielpalme/ReportGenerator.
All cobertura files ( multiple test projects ) are merged into a single one by ReportGenerator and this is then used to generate the report in the Find Code Coverage tool window.
Perhaps you can compare your Coverlet report with the coberturas within
...YourProject\bin\Debug\net6.0\fine-code-coverage\coverage-tool-output
YourProject.coverage.xml is generated by Coverlet Cobertura.xml is the merged version.
The issue could be the Coverlet version, now at 3.1.2, or ReportGenerator. The next FCC release creates its own html report displaying it in a WebView2 control and as such can use the latest version of ReportGenerator which dropped support for ie and the WebBrowser control.
@craigktreasure If you can create a minimal reproduction I will have a look.
@craigktreasure Latest release updates Coverlet to 3.2.0. Does this resolve your issue ?
Yep. It does seem to have resolved the issue. Thanks!