Parameterize CodeCoverage test on IncludeTestAssembly (#52029)#54514
Open
Evangelink wants to merge 1 commit into
Open
Parameterize CodeCoverage test on IncludeTestAssembly (#52029)#54514Evangelink wants to merge 1 commit into
Evangelink wants to merge 1 commit into
Conversation
Unskips RunTestProjectWithCodeCoverage_ShouldReturnExitCodeGenericFailure on Linux/macOS by making it explicit about the IncludeTestAssembly value used by Microsoft.CodeCoverage. - Replaces WindowsOnlyTheory with Theory; the test now runs on all platforms when IncludeTestAssembly is false. - Writes a coverage.config and passes it via --coverage-settings so the test no longer depends on the default value of IncludeTestAssembly in Microsoft.CodeCoverage. - IncludeTestAssembly=true cases remain skipped pending investigation of the underlying BadImageFormatException crash referenced by the issue. Fixes dotnet#52029 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates a dotnet test --coverage regression test to be resilient to future changes in Microsoft.CodeCoverage defaults by explicitly controlling the IncludeTestAssembly setting, while re-enabling coverage validation on Linux/macOS for the non-crashing configuration.
Changes:
- Parameterized the code coverage test on
IncludeTestAssemblyand wrote an explicitcoverage.configpassed via--coverage-settings. - Replaced
WindowsOnlyTheorywithTheoryso theIncludeTestAssembly=falsescenarios run cross-platform. - Kept
IncludeTestAssembly=truescenarios present but skipped with an issue link due to the known crash.
Show a summary per file
| File | Description |
|---|---|
| test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsWithArtifacts.cs | Parameterizes the coverage test and forwards explicit coverage settings; re-enables cross-platform execution for the passing configuration while skipping the known-crashing one. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 1
| [InlineData(TestingConstants.Debug, true, Skip = "https://github.com/dotnet/sdk/issues/52029")] | ||
| [InlineData(TestingConstants.Release, true, Skip = "https://github.com/dotnet/sdk/issues/52029")] | ||
| [Theory] | ||
| public void RunTestProjectWithCodeCoverage_ShouldReturnExitCodeGenericFailure(string configuration, bool includeTestAssembly) |
3 tasks
Youssef1313
reviewed
May 30, 2026
| [InlineData(TestingConstants.Release, false)] | ||
| // When IncludeTestAssembly is true, the test process crashes with BadImageFormatException. | ||
| // See: https://github.com/dotnet/sdk/issues/52029 | ||
| [InlineData(TestingConstants.Debug, true, Skip = "https://github.com/dotnet/sdk/issues/52029")] |
Member
There was a problem hiding this comment.
As long as this is still skipped, original issue shouldn't be closed with this PR
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.
Fixes #52029
Per @Youssef1313's comment:
Changes
test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsWithArtifacts.cs:WindowsOnlyTheorywithTheoryso the test runs on Linux/macOS again.bool includeTestAssemblyparameter. The test writes acoverage.configcontaining<IncludeTestAssembly>true|false</IncludeTestAssembly>and forwards it via--coverage-settings. This decouples the test from any future flip of the Microsoft.CodeCoverage default.[InlineData(..., false)]cases run on every OS (no platform skip).[InlineData(..., true, Skip = "...")]cases stay skipped (with the issue link) becauseIncludeTestAssembly=truestill triggers the unresolvedBadImageFormatExceptioncrash that needs separate investigation.Verification
Ran locally on Windows: