Coverlet MTP extension feature#1788
Merged
Bertk merged 75 commits intocoverlet-coverage:masterfrom Jan 8, 2026
Merged
Conversation
Collaborator
Author
|
The code coverage dropped and shall be fixed before merge. main branch: line 90% branch 87% |
592ff6a to
010a409
Compare
- Updated target frameworks to net472 in coverlet.core and coverlet.msbuild.tasks projects - Adjusted CoverletToolsPath for multi-targeting support in buildMultiTargeting props and targets - Created unit tests for Coverlet.MTP command line options validation - Added documentation for Coverlet.MTP integration
- Added CoverletExtensionCollector to handle test session lifecycle for coverage collection. - Introduced CoverletExtensionCommandLineProvider for command line options. - Created CoverletExtensionConfiguration to manage configuration settings. - Developed CoverletLoggerAdapter for logging integration with Microsoft Testing Platform. - Implemented CoverletExtensionEnvironmentVariableProvider for environment variable management. - Added CoverletExtensionProvider to register the Coverlet extension with the testing platform. - Created TestingPlatformBuilderHook to facilitate extension registration. - Updated project files to include necessary dependencies and configurations for Coverlet. - Added support for multiple target frameworks (net8.0 and net9.0). - Included build and packaging configurations for Coverlet.MTP. - Implemented command line options for coverage report formats and exclusions. - Established logging mechanisms for better traceability during coverage collection.
…ng and add coverage cleanup messages
…ationString for consistency and lowercase output
… consistency across environments
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request introduces Microsoft Testing Platform (MTP) support to coverlet through a new coverlet.MTP package, enabling code coverage collection for projects using the modern Microsoft Testing Platform instead of VSTest.
Key Changes:
- New
coverlet.MTPpackage with full MTP extension implementation - Core infrastructure updates to support managed instrumentation restore control
- Comprehensive test projects for validation and unit testing
- CI/CD workflow additions including GitHub Actions
- Dependency upgrades to support .NET 8/9 and MTP v2.x
- Documentation for MTP integration
Reviewed changes
Copilot reviewed 100 out of 105 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/coverlet.MTP/* | New MTP extension package with command-line providers, collectors, and configuration |
| src/coverlet.core/Helpers/InstrumentationHelper.cs | Added DisableManagedInstrumentationRestore parameter to control backup/restore behavior |
| src/coverlet.core/Coverage.cs | Added parameter support for instrumentation restore control |
| src/coverlet.collector/* | Extended collector settings with DisableManagedInstrumentationRestore flag |
| test/coverlet.MTP.unit.tests/* | Unit tests for MTP extension components |
| test/coverlet.MTP.validation.tests/* | Integration validation tests with sample projects |
| test/coverlet.tests.utils/TestUtils.cs | Added GetBuildConfigurationString() helper for cross-platform path handling |
| Directory.Packages.props | Upgraded dependencies including Microsoft.Testing.Platform v2.0.2, xunit v3.2.1 |
| .github/workflows/dotnet.yml | New GitHub Actions workflow for cross-platform CI/CD |
| Documentation/Coverlet.MTP.Integration.md | Comprehensive MTP integration guide with examples |
| global.json | Updated SDK version to 9.0.308 |
| eng/.yml, eng/.sh | Updated build and test scripts for MTP projects |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Updated target frameworks to net472 in coverlet.core and coverlet.msbuild.tasks projects - Adjusted CoverletToolsPath for multi-targeting support in buildMultiTargeting props and targets - Created unit tests for Coverlet.MTP command line options validation - Added documentation for Coverlet.MTP integration
- Added CoverletExtensionCollector to handle test session lifecycle for coverage collection. - Introduced CoverletExtensionCommandLineProvider for command line options. - Created CoverletExtensionConfiguration to manage configuration settings. - Developed CoverletLoggerAdapter for logging integration with Microsoft Testing Platform. - Implemented CoverletExtensionEnvironmentVariableProvider for environment variable management. - Added CoverletExtensionProvider to register the Coverlet extension with the testing platform. - Created TestingPlatformBuilderHook to facilitate extension registration. - Updated project files to include necessary dependencies and configurations for Coverlet. - Added support for multiple target frameworks (net8.0 and net9.0). - Included build and packaging configurations for Coverlet.MTP. - Implemented command line options for coverage report formats and exclusions. - Established logging mechanisms for better traceability during coverage collection.
…ng and add coverage cleanup messages
…ment for consistency across environments" This reverts commit 06a684c.
- Expanded MTP integration docs and added usage ToDo - Enabled package generation in coverlet.MTP.csproj - Added strong name signing for validation tests - Updated validation test project: new dependencies, utility refs, and test project copying - Updated InternalsVisibleTo for new test assemblies
Introduce a comprehensive validation test suite for the Coverlet Microsoft Testing Platform (MTP) extension, including new integration and CLI option tests. Add isolated test infrastructure with sample projects and custom MSBuild props/targets to ensure tests run in a pure MTP environment. Update packaging logic in coverlet.MTP to improve dependency handling and NuGet layout, and adjust build system to better support MTP scenarios. Also includes minor bug fixes and ensures correct local package versioning in tests.
- Enhance test output with detailed diagnostics and error context
- Use robust assertions with informative failure messages
- Create temp test projects under artifacts/tmp for isolation
- Add retries and file attribute handling to test dir cleanup
- Check for test executable and coverlet.MTP.dll before running
- Refactor HelpCommandTests for consistent path handling
- Fix sample class naming mismatch in test project
- Add condition to MSBuild import for props file robustness
- Update NuGet config and project file handling for clarity
Renamed the constant sutName to SutName in HelpCommandTests to follow .NET PascalCase naming conventions for constants. Updated all references to use the new name for consistency.
Switch all test projects to xunit.v3.mtp-v2 for Microsoft Testing Platform (MTP) integration. Bump Microsoft.Testing.Platform to 2.0.2 and manage Moq version via property. Make Coverlet MTP extension opt-in by default and register as TestingPlatformExtension. Minor formatting and encoding adjustments included.
This was referenced Mar 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several infrastructure and configuration improvements to the project, focusing on modernizing dependencies, enhancing CI/CD workflows, and enforcing code quality standards.
Key update: New coverlet.MTP package for Microsoft Testing Platform support
Continuous Integration and Automation:
.github/workflows/dotnet.ymlGitHub Actions workflow to automate building, testing (with coverage), and reporting for .NET projects across Ubuntu, Windows, and macOS. This workflow includes steps for restoring dependencies, building, running tests with coverage, generating reports, and publishing test results and coverage summaries to PRs..github/dependabot.ymlto enable automated dependency updates with Dependabot, scheduled weekly.Dependency and Package Management:
Directory.Packages.props, includingMicrosoft.CodeAnalysis(to 4.13.0),Microsoft.NET.Test.Sdk(to18.0.1),xunit.v3(to 3.2.1), and others. Added new packages for Microsoft Testing Platform, banned API analyzers, and updated several system and test libraries to their latest versions.CoverletVersionto 8.0.0 inDirectory.Build.propsand improved test logger and output configuration for better compatibility with new test platforms and CI environments.Solution Structure:
coverlet.MTP,coverlet.MTP.validation.tests,coverlet.MTP.unit.tests) to the solution file, including their build and folder organization.Most important changes:
1. Solution and API Governance
2. Documentation
Documentation/Coverlet.MTP.Integration.md).