Skip to content

Coverlet MTP extension feature#1788

Merged
Bertk merged 75 commits intocoverlet-coverage:masterfrom
Bertk:coverlet-MTP
Jan 8, 2026
Merged

Coverlet MTP extension feature#1788
Bertk merged 75 commits intocoverlet-coverage:masterfrom
Bertk:coverlet-MTP

Conversation

@Bertk
Copy link
Collaborator

@Bertk Bertk commented Dec 6, 2025

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:

  • Added a new .github/workflows/dotnet.yml GitHub 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.
  • Introduced .github/dependabot.yml to enable automated dependency updates with Dependabot, scheduled weekly.

Dependency and Package Management:

  • Upgraded multiple dependencies in Directory.Packages.props, including Microsoft.CodeAnalysis (to 4.13.0), Microsoft.NET.Test.Sdk (to 18.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.
  • Updated the default CoverletVersion to 8.0.0 in Directory.Build.props and improved test logger and output configuration for better compatibility with new test platforms and CI environments.

Solution Structure:

  • Added new projects for MTP integration and testing (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

  • Added new projects for Microsoft Testing Platform integration and corresponding tests to the solution file.

2. Documentation

  • Created documentation on Coverlet MTP integration (Documentation/Coverlet.MTP.Integration.md).

@Bertk Bertk added feature PR label for new features breaking-change Issue or PR that represents a breaking change in features or functional. labels Dec 9, 2025
@Bertk
Copy link
Collaborator Author

Bertk commented Dec 9, 2025

The code coverage dropped and shall be fixed before merge.

main branch: line 90% branch 87%
this branch: line 74% branch 71%

@Bertk Bertk added the * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) label Dec 9, 2025
@Bertk Bertk force-pushed the coverlet-MTP branch 2 times, most recently from 592ff6a to 010a409 Compare December 15, 2025 09:47
@Bertk Bertk marked this pull request as ready for review December 24, 2025 12:55
Copilot AI review requested due to automatic review settings December 24, 2025 12:55
- 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.
…ationString for consistency and lowercase output
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.MTP package 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.

Bertk added 11 commits December 24, 2025 14:02
- 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.
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Issue or PR that represents a breaking change in features or functional. enhancement General enhancement request feature PR label for new features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants