Microsoft Code Coverage
github.com
- Free plan
- Windows
- macOS
- Linux
What Microsoft Code Coverage is
Microsoft Code Coverage measures how much of a project’s code is exercised by coded tests, including unit tests. It covers managed CLR and unmanaged native code, with static and dynamic instrumentation. Documented workflows collect coverage for .NET tests using dotnet test and for other .NET applications using the dotnet-coverage tool. With Microsoft.Testing.Platform.MSBuild, coverage extensions are automatically registered when installed alongside MSTest, NUnit, or xUnit runners. The MTP extension can produce coverage, XML, and Cobertura output. Configuration through runsettings or dedicated coverage settings files can control output, inclusion and exclusion rules, and instrumentation options. Windows, macOS, and multiple Linux distributions are supported, but instrumentation availability depends on operating system, version, and architecture. Other operating systems are supported on a best-effort basis, and some combinations allow static instrumentation only. Dynamic instrumentation on macOS and Linux requires libxml2; without a required dependency, a report may be empty. MTP excludes test assemblies by default unless configured otherwise. The free tooling is documented for .NET projects and applications.
Who it suits
It suits developers working with .NET test projects or other .NET applications who want coverage measurements. Teams using MTP, MSTest, NUnit, or xUnit can use its documented coverage workflows.
Good to know, and what to watch
- Measures code exercised by coded tests.
- Covers managed CLR and unmanaged native code.
- Supports static and dynamic instrumentation.
- MTP output includes coverage, XML, and Cobertura formats.
- Configuration supports inclusion and exclusion rules.
- MTP excludes test assemblies by default.
- Dynamic instrumentation on macOS and Linux requires libxml2.
- Instrumentation support varies by OS, version, and architecture.
- Some OS and architecture combinations support static instrumentation only.
Plans
Every plan and priceMicrosoft Code Coverage
Getting started
- Open the Microsoft Code Coverage repository
- Install the relevant Microsoft.CodeCoverage or dotnet-coverage tooling
- Run dotnet test for .NET test coverage
- Use dotnet-coverage for other .NET applications
- Install Microsoft.Testing.Platform.MSBuild with MSTest, NUnit, or xUnit runners
- Configure runsettings or a coverage settings file
- Generate coverage, XML, or Cobertura output
Limits to check
Dynamic instrumentation on macOS and Linux requires libxml2, and missing dependencies may produce an empty report. MTP excludes test assemblies by default, while some operating-system and architecture combinations support static instrumentation only.
The verdict
Microsoft Code Coverage provides documented coverage workflows for .NET tests and applications, with configurable output and instrumentation. Check platform support and the libxml2 requirement before relying on dynamic instrumentation.
Questions people ask
What does Microsoft Code Coverage measure?
It measures how much project code is exercised by coded tests, such as unit tests.
Which code and languages are supported?
It supports managed CLR and unmanaged native code, with documented support for C# and C++.
What report formats are available?
The MTP coverage extension supports coverage, XML, and Cobertura output formats.
Which test runners register coverage automatically?
With Microsoft.Testing.Platform.MSBuild, extensions are auto-registered with MSTest, NUnit, and xUnit runners.
Which operating systems are supported?
Supported systems include Windows, macOS, and multiple Linux distributions, with instrumentation varying by system, version, and architecture.
Does it cost anything?
The Microsoft Code Coverage plan is free to use and listed as free.
What the maker publishes
- Configuration
- Coverage settings can control output, inclusion and exclusion rules, and instrumentation options using runsettings or dedicated coverage settings files. source
- Instrumentation
- The tooling supports static and dynamic instrumentation. source
- Intended users
- The documented workflows cover .NET test projects and other .NET applications that users want to measure for code coverage. source
- Managed and native code
- Coverage analysis supports managed CLR code and unmanaged native code; native coverage is disabled by default in the MTP extension. source
- Operating systems
- The supported operating systems include Windows, macOS, and multiple Linux distributions, with instrumentation support varying by OS, version, and architecture. source
- Platform limits
- Other operating systems are supported on a best-effort basis, and some OS and architecture combinations support static instrumentation only. source
- Purpose
- Measures what proportion of a project's code is exercised by coded tests such as unit tests. source
- Report formats
- The MTP coverage extension supports coverage, XML, and Cobertura output formats. source
- Runtime dependency
- Dynamic instrumentation on macOS and Linux requires the libxml2 package; missing required dependencies may cause an empty coverage report. source
- Security
- The repository links to a security policy, but its README describes this repository as documentation and samples for closed-source coverage functionality. source
- Support
- The repository invites users to report issues related to the Microsoft.CodeCoverage and dotnet-coverage NuGet packages and Visual Studio code coverage functionality. source
- Test assembly default
- MTP excludes test assemblies from coverage by default unless configured otherwise. source
- Test frameworks
- With Microsoft.Testing.Platform.MSBuild, coverage extensions are auto-registered when installed with MSTest, NUnit, and xUnit runners. source
- Usage
- The repository documents collecting coverage for .NET tests with dotnet test and for other .NET applications with the dotnet-coverage tool. source
Checked against the maker's pages on 4 Oct 2026.